Tell us what’s happening:
I think it’s the same but it does not work.
My code will not pass the mutation(["hello", "hey"]);
condition.
Your code so far
function mutation(arr) {
// My Code
// var wCheck = arr[1].toLowerCase();
// for(var i=0; i<arr[1].length; i++){
// if(arr[0].toLowerCase().indexOf(wCheck[i]) == -1){
// return false;
// }
// return true;
// }
// fCC Code
var test = arr[1].toLowerCase();
var target = arr[0].toLowerCase();
for (i=0;i<test.length;i++) {
if (target.indexOf(test[i]) === -1)
return false;
}
return true;
}
mutation(["hello", "hey"]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/mutations