I am working on a simple function that should return the first element of an array that matches my criteria using a for loop. It keeps returning the first element of the array whether it meets the set criteria or not. Any idea where the bug is here? I also tried the .find() method, same issue.
function wheresTheBeef(array) {
for (var i = 0; i < array.length; i++) {
if (array[i] == 'fillet' || 'strip' || 'sirloin') {
return array[i];
}
else {
return 'there is no beef!'
}
}
}