Tell us what’s happening:
The first two works works fine, but the rest of them will return false. I honestly don’t understand what is happening anymore.
Your code so far
function mutation(arr) {
var strA = arr[0].toLowerCase()
var strB = arr[1].toLowerCase()
for (var i = 0; i < arr.length; i++){
if(strA === strB){
return true
} else {
return false
}
}
}
console.log(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/78.0.3904.108 Safari/537.36
.
Challenge: Mutations
Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations