English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The JavaScript Array includes() method determines whether an array contains a certain element.
If the array contains elements, this method returnstrue;otherwise returnfalse.
array.includes(element, start)
var fruits = ['Banana',39;Mango',39;Apple',39;Orange']; ;fruits.includes('Apple');Test and see‹/›
The numbers in the table specify the first browser version that fully supports the include() method:
Method | |||||
includes() | 47 | 43 | 34 | 9 | 14 |
Parameter | Description |
---|---|
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 |
Return value: | a boolean value, if value is found in the array element, thentrue |
---|---|
JavaScript version: | ECMAScript 7 |
From index1Start searching:
var fruits = ['Banana',39;Mango',39;Apple',39;Orange']; ;fruits.includes('Banana' 1);Test and see‹/›