Tell us what’s happening:
I am supposed to flatten a nested array, which I did, but freecodecamp does not accept my solution for some reason. I tested it with console.log and everything should be fine, it returns exactly what it is supposed to.
Your code so far
function steamrollArray(arr) {
let merged = [].concat.apply([], arr);
return merged;
}
steamrollArray([1, [2], [3, [[4]]]]);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.95
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller