Hey,
I was wondering if anyone could help me by explaining why it matters which way round the ‘return true’ and ‘return false’ statements are?
For example this passes the tests:
function mutation(arr) {
let constWord = arr[0].toLowerCase()
let test = arr[1].toLowerCase()
for(let i = 0; i < test.length; i++){
if (constWord.indexOf(test[i]) < 0){
return false;
}
}
return true;
}
Whereas this doesn’t:
function mutation(arr) {
let constWord = arr[0].toLowerCase()
let test = arr[1].toLowerCase()
for(let i = 0; i < test.length; i++){
if (constWord.indexOf(test[i]) >= 0){
return true;
}
}
return false;
}
Thank you!