includes()

Determines whether or not a target is present within a given string, array or object. Unlike Array.prototype.includes(), this function differentiates between -0 and 0.

This function is valid in v2.13.0 to v2.24.3. This function has been downloaded 63 times.

Parameters

{Array|Object|string} subject
The array, object or string in which target should be searched for.
{*} target
The target value to search for within subject.
{number=} opt_start Optional
The position at which to start the search for strings or arrays. This will be ignored for objects. Negative values will be calculated from the end.

Returns

{boolean}
A boolean value indicating if target is present within subject at or after opt_start.

Required Function

This function directly requires the following function which is included automatically:

  • indexOf()
    Gets the index of a specified target value in a string, array or an object. Unlike Array.prototype.indexOf(), this function works for finding NaN and differentiates between -0 and 0.