Answers for "check if array has something js"

13

javascript check if is array

var colors=["red","green","blue"];

if(Array.isArray(colors)){
    //colors is an array
}
Posted by: Guest on July-22-2019
1

check if array does not contain string js

function checkInput(input, words) {
 return words.some(word => new RegExp(word, "i").test(input));
}

console.log(checkInput('"Definitely," he said in a matter-of-fact tone.', 
["matter", "definitely"]));
Posted by: Guest on June-07-2020

Code answers related to "check if array has something js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language