JavaScriptArrayincludes

Determines whether a string contains a specified string.

Syntax

arr.includes(searchElement, fromIndex?)

Example

Enter values below to update the example in real time.

const
arr
console
includes
const arr = [1, 2, 3, 4, 5];
console.log(arr.includes(3));   // true
console.log(arr.includes(9));   // false