Fix typo to fit the context Fix typo add space Fix small typo Fix small typo Fix typo Fix typo Fix typo Fix typo Fix typo Fix typo Fix typo Update tail.md Fix typo Fix small typo Fix typo Fix typo Fix typo Fix typo Fix small typo Fix typo Fix small typo Fix typo Fix typo Fix typo Fix typo Fix typo Fix typo Fix typo Fix typo Fix typo
11 lines
222 B
Markdown
11 lines
222 B
Markdown
### last
|
|
|
|
Returns the last element in an array.
|
|
|
|
Use `arr.length - 1` to compute the index of the last element of the given array and returning it.
|
|
|
|
```js
|
|
const last = arr => arr[arr.length - 1];
|
|
// last([1,2,3]) -> 3
|
|
```
|