Update take.md
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
### Take
|
### Take
|
||||||
|
|
||||||
Use `.slice()` to create a slice of the array with n elements taken from the beginning.
|
Use `Array.slice()` to create a slice of the array with `n` elements taken from the beginning.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const take = (arr, n = 1) => arr.slice(0, n);
|
const take = (arr, n = 1) => arr.slice(0, n);
|
||||||
|
|||||||
Reference in New Issue
Block a user