• 0

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 an array, and each tooth is an item, you'll have a good idea of how the zip operation works. This behavior can be abstracted using Array.prototype.zip().

This post is a follow up post of the
- Getting started Functional Programming in JavaScript. I would recommend reading that post first.

Problem

Find the videos and bookmarks by index

Let's solve with for() loop



Implement Array.prototype.zip() using simple for().



Solve the similar problem using Array.prototype.zip().


Further Reading