Deviopath › JavaScript

Zip Two Arrays

Easy · Arrays

Write a function zip that pairs up items with the same index from two arrays. Return an array of [a[i], b[i]] pairs.

If the arrays have different lengths, stop at the end of the shorter one.

Next: Count Occurrences