Okay, why is mutation(["hello", "hey"])
not returning 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.
1 Like
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.
So, if a return
statement stops my functions… then it stopped at if
and it didn’t read else
, is that it?
No issues, just getting tired.