Tell us what’s happening:
If you were to use the spread operator on the problem the first two test wouldn’t pass, the array is flattened but yet the answer isn’t accepted. Why is that? Maybe I’m trying to take a back route to solving the problem but why doesn’t the spread operator work?
Your code so far
function steamrollArray(arr) {
// I'm a steamroller, baby
var returnArray = [];
return Array(returnArray)
}
steamrollArray([1, [2], [3, [[4]]]]);
steamrollArray([[["a"]], [["b"]]])
steamrollArray([1, {}, [3, [[4]]]])
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller