Both arrays contain the string 'hello', but only the first logs true. Why?
function containsHello(array){
for(let i = 0; i < array.length; i++){
if(array[i] === 'hello'){
return true;
} else {
return false;
}
}
}
console.log(containsHello(['hello', 'no', 'yes'])); // logs true
console.log(containsHello(['no', 'hello', 'yes'])); // logs false
console.login the loop. How many times does it print? How many times do you expect it to print?