This site is mobile accessible. Press the "Tap Here" button to use a smaller font-size.

Smartphone icons created by Freepik - Flaticon

JS Arrays

The includes() Method

Check if the fruit array contains "Mango":

Note: The includes method is not supported in Edge 13 (and earlier versions).

const fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.includes("Mango");

All modern browsers support Array.prototype.includes:

Chrome browser Edge browser Firefox browser Safari browser Opera browser
Chrome 47 Edge 14 Firefox 43 Safari 9 Opera 34
Dec 2015 Aug 2016 Dec 2015 Oct 2015 Dec 2015