How to check if a JavaScript array contains a specific value
By Flavio Copes
Learn how to check if a JavaScript array contains a specific value using the includes() method, which returns true or false depending on whether it is found.
~~~
Use the includes() method on the array instance.
For example:
['red', 'green'].includes('red') //true ✅
['red', 'green'].includes('yellow') //false ❌ ~~~
Related posts about js: