Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-22 20:24:44 +03:00
parent 5cb69e3c5c
commit aa425812b4
40 changed files with 151 additions and 87 deletions

View File

@ -3,11 +3,11 @@ title: zip
tags: array,intermediate
---
Creates an array of elements, grouped based on the position in the original arrays.
Creates an array of elements, grouped based on their position in the original arrays.
- Use `Math.max.apply()` to get the longest array in the arguments.
- Creates an array with that length as return value and use `Array.from()` with a map-function to create an array of grouped elements.
- If lengths of the argument-arrays vary, `undefined` is used where no value could be found.
- Use `Math.max()`, `Function.prototype.apply()` to get the longest array in the arguments.
- Create an array with that length as return value and use `Array.from()` with a mapping function to create an array of grouped elements.
- If lengths of the argument arrays vary, `undefined` is used where no value could be found.
```js
const zip = (...arrays) => {