Steamroller - code works yet freecodecamp refuses to accept the solution

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:

The returned value isn’t quite correct. The 4 is nested in multiple arrays:


Try using console.log(JSON.stringify(...)), the fcc editor has a few limitations

1 Like

If you are looking at the browser’s console which you learned about in the Debugging section, then a simple console.log statement can show you what are returning.