Answers for "javascript method to see if item exists in array"

5

javascript method to see if item exists in array

var fruits = ["Apple", "Banana", "Mango", "Orange", "Papaya"];
    
    // Check if a value exists in the fruits array
    if(fruits.indexOf("Mango") !== -1){
        alert("Value exists!")
    } else{
        alert("Value does not exists!")
    }
Posted by: Guest on April-16-2020

Code answers related to "javascript method to see if item exists in array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language