Fix `nthElement'-example.

This commit is contained in:
Kim A. Brandt
2017-12-18 14:43:20 +01:00
committed by GitHub
parent 84caaa7e63
commit c6f3b7ea27

View File

@ -8,6 +8,6 @@ Omit the second argument, `n`, to get the first element of the array.
```js ```js
const nthElement = (arr, n=0) => (n>0? arr.slice(n,n+1) : arr.slice(n))[0]; const nthElement = (arr, n=0) => (n>0? arr.slice(n,n+1) : arr.slice(n))[0];
// nth(['a','b','c'],1) -> 'b' // nthElement(['a','b','c'],1) -> 'b'
// nth(['a','b','b']-2) -> 'a' // nthElement(['a','b','b'],-3) -> 'a'
``` ```