English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

The JavaScript Array includes() method

 JavaScript Array Object

The JavaScript Array includes() method determines whether an array contains a certain element.

If the array contains elements, this method returnstrue;otherwise returnfalse.

Syntax:

array.includes(element, start)
var fruits = ['Banana',39;Mango',39;Apple',39;Orange'];
;fruits.includes('Apple');
Test and see‹/›

Browser Compatibility

The numbers in the table specify the first browser version that fully supports the include() method:

Method
includes()474334914

Parameter Value

ParameterDescription
element(Required) The element to be searched
start(Optional) The position of the element to start searching in this array. The default value is 0

Technical Details

Return value:a boolean value, if value is found in the array element, thentrue
JavaScript version:ECMAScript 7

More examples

From index1Start searching:

var fruits = ['Banana',39;Mango',39;Apple',39;Orange'];
;fruits.includes('Banana' 1);
Test and see‹/›

 JavaScript Array Object