Tell us what’s happening:
I did the below right off the bat. It seems logical to me. It shrinks the nested arrays down to a simple 1-D array, right?
What am I missing here?
In the hint it suggested using .isArray(), but I don’t understand that at all. I know these are arrays. I read through the doc on MDN and I don’t quite get where the .isArray() suggestion is coming from?
Again, what am I missing here?
Your code so far
function steamrollArray(arr) {
let args = [];
args.push(arr)
console.log(args)
return args;
}
steamrollArray([1, [2], [3, [[4]]]]);
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/intermediate-algorithm-scripting/steamroller