includes (obj, startAt) Boolean
public
Returns true
if the passed object can be found in the array. This method is a Polyfill for ES 2016 Array.includes. If no startAt
argument is given, the starting location to search is 0. If it's negative, searches from the index of this.length + startAt
by asc.
[1, 2, 3].includes(2); // true [1, 2, 3].includes(4); // false [1, 2, 3].includes(3, 2); // true [1, 2, 3].includes(3, 3); // false [1, 2, 3].includes(3, -1); // true [1, 2, 3].includes(1, -1); // false [1, 2, 3].includes(1, -4); // true [1, 2, NaN].includes(NaN); // true
Parameters:
-
obj
Object
- The object to search for.
-
startAt
Number
- optional starting location to search, default 0
Returns:
-
Boolean
- `true` if object is found in the array.
Please login to continue.