Knowledgize

.includes(value, fromIndex)

Determines whether the array contains a certain value among its entries. The method can start the search at a specified index.

Examples:

let fruits = ['apple', 'banana', 'mango']; let includesMango = fruits.includes('mango'); console.log(includesMango); // true
let includesGrape = fruits.includes('grape'); console.log(includesGrape); // false
const fruits = ['apple', 'banana', 'mango', 'orange', 'banana', 'peach']; // Search for 'banana' starting from index 2 const result = fruits.includes('banana', 2); console.log(result); // Output: true // Search for 'banana' starting from index 3 const result2 = fruits.includes('banana', 3); console.log(result2); // Output: true // Search for 'banana' starting from index 4 const result3 = fruits.includes('banana', 5); console.log(result3); // Output: false