last-method
v1.0.2
Published
Gets the last element in an array.
Downloads
1
Readme
last-method
Adds a last method to all arrays. Will return -1 if the array is empty.
Install
npm i last-method
Examples
import 'last-method'
const array = [1, 2, 3, 4, 5]
array.last() // 5
const emptyArray = []
emptyArray.last() // -1