Updated tail description
This commit is contained in:
@ -512,7 +512,7 @@ Use array destructuring to swap values between two variables.
|
|||||||
|
|
||||||
### Tail of list
|
### Tail of list
|
||||||
|
|
||||||
Return `arr.slice(1)`.
|
Return `arr.slice(1)` if the array's `length` is more than `1`, otherwise return the whole array.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const tail = arr => arr.length > 1 ? arr.slice(1) : arr;
|
const tail = arr => arr.length > 1 ? arr.slice(1) : arr;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
### Tail of list
|
### Tail of list
|
||||||
|
|
||||||
Return `arr.slice(1)`.
|
Return `arr.slice(1)` if the array's `length` is more than `1`, otherwise return the whole array.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const tail = arr => arr.length > 1 ? arr.slice(1) : arr;
|
const tail = arr => arr.length > 1 ? arr.slice(1) : arr;
|
||||||
|
|||||||
Reference in New Issue
Block a user