Okay, why is mutation(["hello", "hey"]) not returning false?
mutation(["hello", "hey"])
false
let [a, b] = arr console.log(b) for(let i = 0; i < b.length; i++) { if(a.toLowerCase().includes(b[i].toLowerCase())) { return true } else { return false } } //return ; }
A return statement immediately stops your function.
I tried this and nothing:
console.log(b) let x for(let i = 0; i < b.length; i++) { if(a.toLowerCase().includes(b[i].toLowerCase())) { x = true } else { x = false } return x; } }
There’s clearly a gap in my knowledge regarding conditionals and return. This always stumps me.
conditionals
return
So, if a return statement stops my functions… then it stopped at if and it didn’t read else, is that it?
if
else
No issues, just getting tired.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.