
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
241 Views
Here we need to create a function that takes in an object and a search string and filters the object keys that start with the search string and returns the objectHere is the code for doing so −Exampleconst obj = { "PHY": "Physics", "MAT": "Mathematics", "BIO": "Biology", ... Read More

AmitDiwan
4K+ Views
To embed the elements of an array inside a div, we just need to iterate over the array and keep appending the element to the divThis can be done like this −Exampleconst myArray = ["stone", "paper", "scissors"]; const embedElements = () => { myArray.forEach(element => { ... Read More

AmitDiwan
223 Views
We have the following array of objects that contains two objects and we are required to combine both objects into one and get rid of the chk property altogether −const err = [ { "chk" : true, "name": "test" }, { ... Read More

AmitDiwan
489 Views
There exists two ways actually to clear the localStorage via JavaScript.Way1 − Using the clear() methodlocalStorage.clear();Way2 − Iterating over localStorage and deleting all keyfor(key in localStorage){ delete localStorage[key]; }Both ways will work.Example if (typeof(Storage) !== "undefined") { localStorage.setItem("product", "Tutorix"); // cleared before displaying localStorage.clear(); ... Read More

AmitDiwan
403 Views
Let’s say we are given the following code and output and we need to figure out why JavaScript converts empty strings(“ “) to 0 −const digify = (str) => { const parsedStr = [...str].map(Number) return parsedStr; } console.log(digify("778 858 7577"))Output[ 7, 7, 8, 0, 8, 5, 8, 0, ... Read More

AmitDiwan
1K+ Views
Let’s say we are required to write a function that takes in an array and changes the id attribute of first n divs present in a particular DOM according to corresponding values of this array, where n is the length of the array.We will first select all divs present in ... Read More

AmitDiwan
2K+ Views
We need to write a function that takes in a string file path and returns the filename. Filename usually lives right at the very end of any path, although we can solve this problem using regex but there exists a simpler one-line solution to it using the string split() method ... Read More

AmitDiwan
379 Views
Let’s say we need to convert the following array of array into array of objects with keys as English alphabetconst data = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]];This can be done by mapping over the actual arrays and reducing the subarrays into objects like ... Read More

AmitDiwan
294 Views
Let’s say our sample string is −const a = "250, 5";If the number after “, ” is a single digit we have to append a 0 to it, If the string contains more than one ‘, ’, we have to return -1This can be done simply by combining the split() ... Read More

AmitDiwan
277 Views
Here we are supposed to write a function that takes in two arguments, first an array of String or Number literals, second a String and we have to return a string that contains all the elements of the array prepended and appended by the string.For example −applyText([1, 2, 3, 4], ... Read More