Modern JavaScript
About Lesson

In this JavaScript lesson we are going to talk about JavaScript Include(), so it returns true if an array includes a value, if not returns false, and it is a feature on JavaScript ES7.

 

 

So now let’s create a simple example, if you see in this example we have create an array of numbers and after that we are using include function to check if we have the 3 number in our array, if you run the code you will see that we are receiving true, because the 3 number is available in our array.

 

 

Also you can use strings, in this example if you see we have an array of names, and we want to use include to find a name if we have in the array, for example we will receive true.