JavaScript Array includes() Method

The JavaScript array includes() method checks whether the given array contains the specified element. It returns true if an array contains the element, otherwise false.

The includes() method determines whether an array contains a specified element.

This method returns true if the array contains the element, and false if not.


array.includes(element, start)


element - The value to be searched.

start - It is optional. It represents the index from where the method starts search.


var fruits = ["Banana", "Orange", "Apple", "Mango"];
var n = fruits.includes("Banana", 3);

Example -