a-last
v1.0.0
Published
Returns the last n element of an array
Downloads
2
Readme
a-last
Returns the last n element of an array
Install
$ npm install --save a-last
Example
var last = require('a-last');
var arr = [1, 2, 3, 4, 5];
console.log(last(arr, 2));
// -> [4, 5]
console.log(last(arr));
// -> [5]
require('a-last')(array, n)
Arguments:
array
: The arrayn
: number of last n elements that wants to be returned- If we do not mention argument n then function will return last element of array
Returns: Returns the last n element of an array
License
© 2016 vikram. MIT License