The solution seems to be correct but i am not passing the testg the ts

Tell us what’s happening:

my solution looks correct but i am not passing the test

Your code so far


function steamrollArray(arr) {
return arr
.toString()
.replace(",,",",")
.split(",")
.map(function(v) {
  if (v == "[object,object]") {
    return{};
  }else if (isNaN(v)) {
    return v;
  } else {
    return parseInt(v);
  }
}
);
}

console.log(steamrollArray([1, [2], [3, [[4]]]]));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36.

Challenge: Steamroller

Link to the challenge:

you are splitting on a comma

v will never have a comma inside so v == "[object, object]" will always be false

you could also try JSON.stringify(...) but you still need to adjust your logic

I suggest pythontutor, or something else that let you see what happens to the values at each step
or heavy use of console.log() statements