Is there a Javascript equivalent of the python \'for-else\' loop, so something like this:
searched = input(\"Input: \");
for i in range(5):
if i==searched:
If your ultimate is goal is to check whether given input is there are not in an array, you can simply make use of indexOf
function.
var arr = [1,2,3,4,5]
var lookingFor = 5 ;
if ( arr.indexOf(lookingFor) > -1 ) {
console.log("Input is here") ;
} else {
console.log("Nope");
}
https://jsfiddle.net/7wnasv5e/