Three Useful Hacks For JavaScript
Getting array items from behind to front If you want to get the array items from behind to front, just do this: var newArray = [1, 2, 3, 4]; console.log(newArray.slice(-1)); // [4] console.log(newArray.slice(-2)); // [3, 4] console.log(newArray.slice(-3)); // [2, 3,…