Lodash _.includes() Method
The _.includes() method is used to find the value is in the collection or not. If the collection is a string, it will be tested for a value sub-string, otherwise SameValueZero() method is used for equality comparisons. If the index is given and is negative, the value is tested from the end indexes of the collection as the offset.
_.includes( collection, value, index )
Parameters: This method accepts three parameters as mentioned above and described below:
- collection: This parameter holds the collection to inspect. Collection can be an array or object or string.
- value: This parameter holds the value to search for.
- index: This parameter holds the index to search from.
Return Value: This method returns true if the value is found in the collection, else false.
true false false
true false true