JavaScript Array includes() Method

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



JavaScript Array includes() Method


❮ JavaScript Array Reference




Example


Check if an array includes "Mango":



var fruits = ["Banana", "Orange", "Apple", "Mango"];

var n = fruits.includes("Mango");

<!--


The result of n will be:



true
-->
Try it Yourself »


Definition and Usage


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.


Note: The includes() method is case sensitive.



Browser Support














Method
includes() 47 14.0 43 9 34

Syntax



array.includes(element, start)

Parameter Values







Parameter Description
element Required. The element to search for
start Optional. Default 0. At which position in the array to start the search

Technical Details






Return Value: A Boolean
JavaScript Version: ECMAScript 7

More Examples




Check if an array includes "Banana", starting the search at position 3:



var fruits = ["Banana", "Orange", "Apple", "Mango"];

var n = fruits.includes("Banana", 3);

<!--


The result of n will be:



false
-->
Try it Yourself »



❮ JavaScript Array Reference

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)