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
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
npm i last-method
2
1.0.2
MIT
2.7 kB
6