The first console.log
is supposed to display "Found Droids!" and the second is supposed to display "Not Found", but I get the same "Not Found" message for both. Not sure how to utilize forEach
in this case.
function droids(arr) {
let result = '';
if (arr.forEach === "Droids") {
result = "Found Droid!"
} else {
result = "Droid Not Found"
}
return result;
}
const starWars = ["Luke", "Finn", "Rey", "Kylo", "Droids"]
const thrones = ["Jon", "Danny", "Tyrion", "The Mountain", "Cersei"]
console.log(droids(starWars))
console.log(droids(thrones))