Steamroller test for not using flat or flatMap fails, yet my solution does not use either

Tell us what’s happening:
The Steamroller exercise test for not using flat or flatMap fails, yet my solution does not use either.

Your code so far


function steamrollArray(arr) {
  const flatten = (arr) => 
   arr.reduce((acc, cur) => 
     acc.concat(Array.isArray(cur) ? flatten(cur) : cur), []);

  return flatten(arr);
}

steamrollArray([1, [2], [3, [[4]]]]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0.

Challenge: Steamroller

Link to the challenge:

Try changing the word flatten to bananas in your code.

1 Like

Thanks Jeremy. Didn’t think they’re just parsing for the word flat.

This should be getting fixed BTW, not sure what happened but the PR seems to have been forgotten about. I pinged some people in the PR, let’s see what happens.

2 Likes