Javatpoint Logo
Javatpoint Logo

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.

Syntax

The includes() method is represented by the following syntax:

Parameter

element - The value to be searched.

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

Return

A Boolean value.

JavaScript Array includes() method example

Here, we will understand includes() method through various examples.

Example 1

Let's see a simple example to determine whether the given array contains the specified element.

Test it Now

Output:

true

Example 2

In this example, we will provide the index from where the search starts.

Test it Now

Output:

false

Example 3

Let's see one more example to determine whether the includes() method is case-sensitive.

Test it Now

Output:

false

Next TopicJavaScript Array





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA