Tell us what’s happening:
I am trying to make 2D array like this:
[[false, false, false, false],
[false, false, false, false],
[false, false, true, false],
[false, false, false, false],
[false, false, false, false],
[false, false, false, false],
[false, false, false, false]]
and again, check which values each sub array have:
[false, false, true, false, false, false, false]
finally, check once more whether the array has at least one false. if so, return false ore return true.
but when i try to make this arrays in the loop, syntax error occur.
is there any other logic to solve this problem?
Your code so far
function mutation(arr) {
var firstArr=arr[0].toLowerCase().split("");
var secondArr=arr[1].toLowerCase().split("");
var result=[];
var answer=[];
for(i=0;i<firstArr.length;i++) {
for(n=0;n<secondArr.length;n++) {
result[i]=secondArr[n]==firstArr[i]? true:false;
}
}
return answer;
}
mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/mutations