arr.push(...items) - adds items to the end.arr.pop() - extracts an item from the end.arr.shift() - extracts an item from the beginning.arr.filter(function(currentValue, index, arr), thisValue) - returns array that filtered out items that don't return true for the function.
thisValue is optional. A value to be passed to the function to be used as its "this" value.arr.unshift(...items) - adds items to the beginning.indexOf/lastIndexOf and includes:
arr.indexOf(item,from) - looks for item starting from index from , and returns the index where it was found, otherwise -1.arr.lastIndexOf(item, from) - same, but looks from right to left.arr.includes(item, from) - looks for item starting from index from, returns true if found.
let arr = [1, 0, false];
alert( arr.indexOf(0) ); // 1
alert( arr.indexOf(false) ); // 2
alert( arr.indexOf(null) ); // -1
alert( arr.includes(1) ); // true
<aside>
💡 Note that the methods use === comparison. So, if we look for false, it finds exactly false and not zero.
</aside>
If we want to check for inclusion, and don’t want to know the exact index, then arr.includes() is preferred.
Also, a very minor difference of includes is that it correctly handles NaN, unlike indexOf/lastIndexOf: