
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
3K+ Views
Suppose we have a JSON object like this −const obj = { "LAPTOP": [{ "productId": "123" }], "DESKTOP": [{ "productId": "456" }], "MOUSE": [{ "productId": "789" }, { "productId": "012" }], ... Read More

AmitDiwan
602 Views
We are required to write a JavaScript function that takes in two numbers specifying a range. Our function should return a random prime number that falls in that rangeExampleThe code for this will be −const range = [100, 1000]; const getPrimes = (min, max) => { const result = ... Read More

AmitDiwan
139 Views
Suppose we have an array of true/false represented by 't'/'f' which we retrieved from some database like this −const arr = ['f', 't', 'f', 't', 't', 't', 'f', 'f', 't', 't', 't', 't', 't', 't', 'f', 't'];We are required to write a JavaScript function that takes in one such array. ... Read More

AmitDiwan
206 Views
We are required to write a JavaScript function that takes in two strings, say str1 and str2. The function should then count and return the number of times str2 appears in str1'For example −count('this is a string', 'is') should return 2;ExampleThe code for this will be −const str1 = 'this ... Read More

AmitDiwan
2K+ Views
Suppose we have an array of arrays that contains the marks of some students in some subjects like this −const arr = [ ["English", 52], ["Hindi", 154], ["Hindi", 241], ["Spanish", 10], ["French", 65], ["German", 98], ["Russian", 10] ];We are required to write a JavaScript function that takes in one such ... Read More

AmitDiwan
956 Views
We are required to write a JavaScript function that takes in a number as one and the only argument. The function should then return a randomly generated string of the length specified by the argument.The character set to be used for the string generation should only contain uppercase and lowercase ... Read More

AmitDiwan
1K+ Views
Cartesian ProductThe Cartesian product of two sets (arrays) A and B, denoted A × B, is the set (array) of all ordered pairs (a, b) where a is in A and b is in B.In simpler terms, a cartesian product of two arrays is a permutation of all possible arrays ... Read More

AmitDiwan
241 Views
Suppose, we have an array of Strings that contains month-year combined strings like this −const arr = ["2009-feb", "2009-jan", "2010-mar", "2010-jan", "2011-jul", "2011-sep", "2011-jan", "2012-jan", "2012-dec", "2012-feb", "2013-may", "2013-jul", "2013-jun", "2014-jan", "2014-dec", "2014-may", "2015-may", "2015-jan", "2015-jun", "2016-jan", "2016-dec"];We are required to write a JavaScript function that takes in one such ... Read More

AmitDiwan
214 Views
Let's say we have such an array −const arr = [A, A, B, B, C, C, D, E];We are required to create an algorithm so that it will find all the combinations that add up to the whole array, where none of the elements are repeated.Example combinations −[A, B, C, ... Read More

AmitDiwan
1K+ Views
We are required to write a JavaScript function that takes in an array of literals as the first argument and a string as the second argument. Our function should return the count of the number of times that string (provided by second argument) appears anywhere in the array.ExampleThe code for ... Read More