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:
You can either use a boolean or you can simply return. Some thing along this line should work...
boolean
return
var search = function(num){ found = false; for(var i in [0,1,2,3,4]){ if(i===num){ console.log("Match found: "+ i); return true; } } return false; };