Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 376 Bytes

File metadata and controls

15 lines (13 loc) · 376 Bytes
title description author tags
Zip Arrays
Combines two arrays by pairing corresponding elements from each array.
Swaraj-Singh-30
array,map
const zip = (arr1, arr2) => arr1.map((value, index) => [value, arr2[index]]);

// Usage:
const arr1 = ['a', 'b', 'c'];
const arr2 = [1, 2, 3];
console.log(zip(arr1, arr2)); // Output: [['a', 1], ['b', 2], ['c', 3]]