# Monthly Archive: February 2016

## Implement zip in javascript

Reducing an array to a single value When we need to combine two arrays by progressively taking an item from each and combining the pair. If you visualize a zipper, where each side is...

## Implement reduce in javascript

Reducing an array to a single value Often we have to iterate over the array by accessing multiple items at a time. For example, if you have to find the largest element in an...

## 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...

## Lambda operator filter and map chaining

Problem Filter only those videos with a rating of 5.0 and return the id of such videos. Solution Further Reading Functional Programming

## 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...

## Implement map in javascript

Projecting Arrays Applying a value to a function and getting a new value is called a projection. To project (transform) one array to another, we have to process each element in the array and...

## Getting started with Functional programming in javascript

This series of posts will train you how to use functional programming in javascript, which is the foundation of many modern javascript based frameworks. This post is a pre-requisite for the following posts on...

## Use map to accept an additional argument in javascript

Problem Write a function Array.prototype.map() which can accept one additional argument. function mul(x) { return x * x; } console.log([1, 2, 3].map(mul)); // [1, 4, 9] Modify the function so that it can accept...

## Closures: javascript interview question

Problem Write a function sum which can accept both the syntax. sum(5, 3) // 8 sum(5)(3) // 8 Logic Whenever the sum is called we need to detect if its called with two arguments...