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
Gets the last element in an array.
Homepage Repository npm JavaScript Download
npm install last-method@1.0.2
Adds a last method to all arrays. Will return -1 if the array is empty.
npm i last-method
import 'last-method'
const array = [1, 2, 3, 4, 5]
array.last() // 5
const emptyArray = []
emptyArray.last() // -1