Steamroller, my solution is similar to provided, why doesn't it work?

Tell us what’s happening:
This is one of three questions I’m having trouble with. Basically, I think my solution works. I looked at the provided solution, Which works basically the same way, although uses push instead of concat as it’s array builder, but mine isn’t working.

I wouldnt post, but on an earlier challenge, where I was supposed to return undefined, I wasn’t able to do so by allowing the function to finish with no return, OR by returning the word “undefined” or undefined. and for that challenge I was 100% confident that my solution did meet requirements, if in other testing engines.

basically I don’t want to walk away thinking my solution has a problem if it actually works. I want to be confident that although there are other answers, mine DID function appropriately.

Your code so far

function steamrollArray(arr) {
  let result = [];
  let roll = function (item) {
    let rolled = [];
    if (Array.isArray(item)) {
      for (let i = 0; i < item.length; i++) {
      return rolled;
    } else {  
      return item;
  for (let i = 0; i < arr.length; i++) {
  // I'm a steamroller, baby
  return result;

console.log(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/75.0.3770.100 Safari/537.36.

Link to the challenge:

concat creates/returns a new array instead of mutating the original array. You will need to assign the returned value a variable and then return it. You could assign the result back to rolled and result (after their respective for loops).

thanks! let me look at that. that’s probably it.

that worked. I’m going to go back and post the other question.