arrayIncludes
The arrayIncludes task determines whether an array includes a given element and returns true or false as appropriate. When used with a fromIndex value, you can specify where in the array the search should begin.
Potential use case
Suppose you have a list of email addresses and want to check whether a certain address is in that list. Specify the address you’re looking for — if it is present, the result is true; if not found, the result is false.
Properties
Example
In this example:
- The array is statically set to
["1","2","3"]. - The
searchElementto find is the number2. - The
fromIndexdefaults to0. - The
resultistruebecause2is present in the array.
