I have this jQuery code part:
$.each(myArray, function(index, val) {
if (val == "Test" ) {
console.log("FOUND")
return
}
});
console.log("DEBUG")
I get both logs: "FOUND" and "DEBUG"
But I would like to exit the function directly after the value was found. I guess that my "return" only exit the loop, but not the whole function.
Is there any solution that I can exit the loop and exit the function in one line?