9 lines
156 B
Markdown
9 lines
156 B
Markdown
### Last of list
|
|
|
|
Use `arr.slice(-1)[0]` to get the last element of the given array.
|
|
|
|
```js
|
|
const last = arr => arr.slice(-1)[0];
|
|
// last([1,2,3]) -> 3
|
|
```
|