Using Array.includes() to Check for Presence in Javascript


Determine if an array contains a certain value.

Source Code

let fruits = ["apple", "banana", "mango"];
console.log(fruits.includes("banana")); // true
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments