This basically tells about true or false. If the item is found then it returns true, else false is returned. You can achieve the same in JavaScript arrays, using includes.
Example
Following is the code −
var nameList = [ "John", "David", "Bob", "Carol", "Sam" ] console.log(nameList.includes("Bob")); console.log(nameList.includes("Adam"));
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo286.js.
Output
This will produce the following output on console −
PS C:\Users\Amit\javascript-code> node demo286.js true false