Answers for "javascript string in array"

4

check string in array of string in js

const names = ["Mario", "Anna", "Jacob"];

console.log(names.includes("Jade")) // Output: False
// It Checks If (Names) Contain's ("Jade") Or Not


console.log(names.includes("Anna")) // Output: True
// It Checks If (Names) Contain's ("Anna") Or Not
Posted by: Guest on July-14-2021
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

see if array contains array javascript

const found = arr1.some(r=> arr2.indexOf(r) >= 0)
Posted by: Guest on April-30-2020

Code answers related to "javascript string in array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language