Tell us what’s happening:
Hi! Thanks for interesing! Look, i know that the code is a little useless, but, it returns what the exercise asked as well, however, i can’t sucess the test with this code; any idea?
Your code so far
function mutation(arr) {
let x = 0;
arr[0] = arr[0].toLowerCase();
arr[1] = arr[1].toLowerCase();
for (let i = 0; i<arr[0].length; i++){
if (arr[0].indexOf(arr[1].split("")[i]) !== -1) {
x++;
}
}
console.log(x==arr[1].length ? true:false)
}
mutation(["hello", "hey"])
mutation(["hello", "Hello"])
mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"])
mutation(["Mary", "Army"])
mutation(["Alien", "line"])
mutation(["floor", "for"])
mutation(["hello", "neo"])
mutation(["voodoo", "no"])
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
.
Link to the challenge:
//https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/mutations