Answers for "How to Check if a JavaScript array contains a string​"

0

How to Check if a JavaScript array contains a string​

let colors = ["Red", "Green", "Blue"];
console.log(colors.indexOf("Green"));  // Output: 1
console.log(colors.indexOf("White"));  // Output: -1
Posted by: Raja MS on February-14-2024

Code answers related to "How to Check if a JavaScript array contains a string​"

Code answers related to "Javascript"

Browse Popular Code Answers by Language