array-last icon indicating copy to clipboard operation
array-last copied to clipboard

Return the last element in an array. Faster than `.slice`

Results 9 array-last issues
Sort by recently updated
recently updated
newest added

you took independent action for scene -- n === 1, but another scene like n > arr.length , like arr.length == 1, and its necessary to use another tool like...

```js // Get the last or last n elements in an array. export default function (array, num = 1) { if (!Array.isArray) throw new Error('array-first expects an array as the...

When n is negative, ```javascript new Array (n) ``` throws an error. **RangeError: Invalid array length**

Yo~! This improves performance significantly on any number slicing or parsing. It also defaults any `NaN`-derived value to `1`, the default. I also included a simple solution to #7. Custom...

The second parameter length bug

Whe the second argument less than 0, there will be an error. Should we change the code like below to support negative number. example: ``` n = isNumber(n) ? Math.abs(+n)...

When the length of the second parameters is greater than the length of the array,The `undefined` will be included in the result. example: var last = require('array-last'); var a =...

- Environment 1: - Arch linux/4.12.8-2-ARCH - node v8.5.0 - npm 5.3.0 - Environment 2: - macOS 10.12.6 - node v8.3.0 - npm 5.4.2 ``` $ npm list --depth=0 [email protected]...