Category: Array

Netflix 0

Implement concatAll in javascript

Querying Nested Arrays To work with tree data structure we need to flatten them. We will be solving a problem using Array.prototype.forEach(). We will define Array.prototype.concatAll() using Array.prototype.forEach(). We will solve the same problem...

Netflix 0

Implement filter in javascript

Predicating Arrays Filtering also key method for manipulating collections. We iterate over the array and add an item to the new array if it passes the test. We will be solving a problem using...

0

Dedupe an array in javascript

Input : An array Output : An array Logic : Iterate over the input array called data Add the element to the output array called result if the element does not exist in the...

1

Find duplicates in an array using javascript

Problem : Given an array of positive integers find all the duplicate elements. Algorithm : Iterate over the array using forEach Find if there is a duplicate for the element using indexOf indexOf takes...

Show Buttons
Hide Buttons