Merge pull request #60 from benhanks040888/master

Check for array length in tail function to return the correct value f…
This commit is contained in:
Angelos Chalaris
2017-12-13 11:39:30 +02:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@
Return `arr.slice(1)`.
```js
const tail = arr => arr.slice(1);
const tail = arr => arr.length > 1 ? arr.slice(1) : arr;
// tail([1,2,3]) -> [2,3]
// tail([1]) -> [1]
```