Example 1 — Official: Pair Items by Position
The sample from the Ramda docs: match each number with the letter at the same index.
console.log(R.zip([1, 2, 3], ['a', 'b', 'c']));
// [[1, 'a'], [2, 'b'], [3, 'c']] How It Works
- Index 0.
1and'a'become[1, 'a']. - Index 1.
2and'b'become[2, 'b']. - Index 2.
3and'c'become[3, 'c']. - Result. Both lists have 3 items, so there are 3 pairs.
