Tell us what’s happening:
I am struggling to understand this exercise. I have lowercased the strings in the array and looped through to check if the second string has the index of the first string.
Where did I go wrong?
Your code so far
function mutation(arr) {
let secondArr = arr[1].toLowerCase();
let firstArr = arr[0].toLowerCase();
for(let i = 0; i < arr.length; i++){
if(firstArr.indexOf(secondArr) != -1){
return true;
}
return false;
}
}
mutation(["hello", "hey"]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36
.
Challenge: Mutations
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations