Array.includes() in JavaScript

By Hemanta Sundaray on 2021-09-21

The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.

const fruits = ["Apple", "Strawberry", "Banana"]

console.log(fruits.includes("Apple"))
// true

console.log(fruits.includes("Grapes"))
// false

Join the Newsletter