![]() |
VOOZH | about |
Lodash _.includes()method is used to find whether 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 );Return Value: This method returns true if the value is found in the collection, else false.
Example 1: In this example, we are checking whether the given value is present in the given collection or not by the use of the _.includes() method.
Output:
true
false
falseExample 2: In this example, we are checking whether the given value is present in the given collection or not by the use of the _.includes() method.
Output:
true
false
true