Answers for "javascript element in array"

12

javascript element in array

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

var n = fruits.includes("Mango");
Posted by: Guest on March-02-2020
1

javascript list include

const array1 = [1, 2, 3];

console.log(array1.includes(2));
// expected output: true

const pets = ['cat', 'dog', 'bat'];

console.log(pets.includes('cat'));
// expected output: true

console.log(pets.includes('at'));
// expected output: false
Posted by: Guest on April-22-2020
2

js in_array

var a = [1, 2, 3];
a.includes(2); // true 
a.includes(4); // false
Posted by: Guest on July-28-2020

Code answers related to "javascript element in array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language