Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -921,24 +921,8 @@ Returns the last element of an array. Passing n will return the last n elements

// Native
const numbers = [1, 2, 3, 4, 5];
numbers[numbers.length - 1];
// => 5
//or
numbers.slice(-1)[0];
// => 5
//or
[].concat(numbers).pop()
// => 5
//or
numbers.at(-1);
// => 5

// Native (works even with potentially undefined/null)
[].concat(undefined).pop()
// => undefined

numbers.slice(-2);
// => [4, 5]
```

#### Browser Support for `Array.prototype.concat()`
Expand Down