JavaScript - Arrays - includes
// Array.prototype.includes()
arr.includes(searchElement)
arr.includes(searchElement, fromIndex)
The includes() method determines whether an array includes a certain element,
returning true or false as appropriate.
searchElement: The element to search for.
fromIndex: Optional. The position in this array at which to begin searching for
searchElement. A negative value searches from the index of array.length +
fromIndex by asc. Defaults to 0.
[1, 2, 3].includes(2); // true
[1, 2, 3].includes(4); // false
[1, 2, 3].includes(3, 3); // false
[1, 2, 3].includes(3, -1); // true
[1, 2, NaN].includes(NaN); // true
page revision: 0, last edited: 12 Nov 2016 04:22