Check if the array includes a certain value: `includes()`
Check if the array includes a certain value: includes()
If you want to check if the array includes a specific value, you can use includes()
method. The first mandatory input argument of includes()
method is the value of the element you want to check.
If you want to check if the value is included starting from a specific index you can use the second input parameter for setting the index (remember to start from 0 for counting the position).