Steamroller (tests not working)

Tell us what’s happening:

So, this code solves all the problems, but it’s not passing the test and I don’t know why. Anybody have any ideas? Thank you for your help.

Your code so far

var good=[];
function steamrollArray(arr) {
  for(var i = 0; i<arr.length; i++){
      var newArr = steamrollArray(arr[i]);
  return good ;

steamrollArray([1, {}, [3, [[4]]]]);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36.

Link to the challenge:

Your code contains global variables that are changed each time the function is run. This means that after each test completes, subsequent tests start with the new value. To fix this, make sure your function doesn’t change any global variables, and declare/assign variables within the function if they need to be changed.


var myGlobal = [1];
function returnGlobal(arg) {
  return myGlobal;
} // unreliable - array gets longer each time the function is run

function returnLocal(arg) {
  var myLocal = [1];
  return myLocal;
} // reliable - always returns an array of length 2