Tell us what’s happening:
Describe your issue in detail here.
Hi All
Why is this not accepted in false cases? I have printed to the console inside the if statement. The condition is met, the lines are printed - but the function does not return. I can’t see why, it should be as simple as it can get. It’s as if the return statement is somehow broken, but it’s well inside the curly brackets, so I can’t see why it doesn’t work.
Please help. What am I missing? This solution is virtually identical to others posted (that do work) and I’m going crazy trying to find why.
Thanks!
**Your code so far**
[spoiler]
function truthCheck(collection, pre) {
collection.forEach((arrElement) => {
if (!arrElement[pre]) {
return false;
}
});
return true;
}
[/spoiler]
truthCheck([{name: "Quincy", role: "Founder", isBot: false}, {name: "Naomi", role: "", isBot: false}, {name: "Camperbot", role: "Bot", isBot: true}], "isBot")
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0
Challenge: Intermediate Algorithm Scripting - Everything Be True
Link to the challenge: