How to check if a JavaScript array contains a specific value 🤔

How to check if a JavaScript array contains a specific value 🤔

Given a JavaScript matrix, how could we verify if it contains a specific element?

If this is possible and is very easy to do in Javascript, for this we will use the includes () method

method includes()

Given a matrix, the includes () method determines if a specific element is found in that matrix, in the case that this element is found to be true and in the case that it is not, it would return false.

For example:

If the article you liked or you found interesting, please help me with 👏 🤓 You can follow me on Twitter or find me on GitHub by visiting my website.

Francisco Imanol Suarez on about.me
I am a web developer, student, and photographer in Trelew, Argentina. Read my articles.about.me