I have an array tempArray = ["Kathmandu","Pokhara","Dharan"]. To make sure that “Pokhara” is in tempArry, I have to use loop and check every element of tempArray.
Is there a way to implement Ruby’s Array.include? so that I don’t need to use a loop?
You can use
Array.indexOfto search for a value:Unfortunately,
Array.indexOfis not implemented in Internet Explorer, but you can look on StackOverflow how to add it back.