includes
The includes() method checks whether an array contains a given element.
Interactive example
Syntax
Classic signature
typescript
function includes<
GenericArrayValue extends unknown
>(
input: readonly GenericArrayValue[],
value: NoInfer<GenericArrayValue>
): booleanCurried signature
typescript
function includes<
GenericArrayValue extends unknown
>(
value: NoInfer<GenericArrayValue>
): (input: readonly GenericArrayValue[]) => booleanParameters
input: The array to search in.value: The value to search for in the array.
Return value
true if the array contains the value, false otherwise.
See also
indexOf- Returns the index of the first occurrencefind- Finds the first element that satisfies a condition
