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 10740 Articles
AmitDiwan
5K+ Views
We have two arrays of literals that contain some common values, our job is to write a function that returns an array with all those elements from both arrays that are not common.For example −// if the two arrays are: const first = ['cat', 'dog', 'mouse']; const second = ['zebra', ... Read More
AmitDiwan
2K+ Views
Let’s say, we have an array of objects like this −const arr = [ { id: 1, parent_id: 0, title: 'Movies' }, { id: 2, parent_id: 0, title: 'Music' }, { id: 3, parent_id: 1, title: 'Russian movies' }, { id: 4, parent_id: 2, title: 'Russian ... Read More
AmitDiwan
119 Views
We have an array of strings each of which contain one or more numbers like this −const arr = ['di5aster', 'ca1amity', 'cod3', 'ho2me3', 'ca11ing'];We are required to write a sorting function that sorts this array in ascending order of the numbers present in the strings. The correct order will be ... Read More
AmitDiwan
345 Views
Let’s say, we are required to write a function that takes in an array of Numbers and number n, where n >= any number of the array. The function is required to break the array into subarrays if the sum of consecutive elements of the array exceeds the number n.For ... Read More
AmitDiwan
230 Views
We have to write a function that takes in an array, removes all duplicates from it and inserts the same number of empty strings at the end.For example − If we find 4 duplicate values we have to remove then all and insert four empty strings at the end.Therefore, let’s ... Read More
AmitDiwan
289 Views
We have to write a simple function in JavaScript that takes in an array of Numbers (nested to any level) and return the greatest number present in the array.For example − If the input array is −const arr = [ 34, 65, 67, [ 43, ... Read More
AmitDiwan
623 Views
Suppose we have two arrays, for an example consider the following two −const array1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']; const array2 = [ 1, 0, 0, 1 , 0, 0, 1, 0];Both the arrays are bound to have the same length. We are required to write ... Read More
AmitDiwan
1K+ Views
Let’s say, we have an array of objects like this −const arr = [ {"id":0, "start":0, "duration":117, "slide":4, "view":0}, {"id":0, "start":0, "duration":12, "slide":1, "view":0}, {"id":0, "start":0, "duration":41, "slide":2, "view":0}, {"id":0, "start":0, "duration":29, "slide":3, "view":0}, {"id":0, "start":0, "duration":123, "slide":3, "view":0}, {"id":0, "start":0, "duration":417, "slide":2, "view":0}, ... Read More
AmitDiwan
377 Views
Let’s say, we have an array of literals that contains some duplicate values −const arr = ['Cat', 'Dog', 'Cat', 'Elephant', 'Dog', 'Grapes', 'Dog', 'Lion', 'Grapes', 'Lion'];We are required to write a function that returns the count of unique elements in the array. Will use Array.prototype.reduce() and Array.prototype.lastIndexOf() to do this ... Read More
AmitDiwan
2K+ Views
Let’s say we have an array of object that contains the scores of some players in a card game −const scorecard = [{ name: "Zahir", score: 23 }, { name: "Kabir", score: 13 }, { name: "Kunal", ... Read More