Steamroller solution giving right answer to other interpreter but not in free code camp

Steamroller solution giving right answer to other interpreter but not in free code camp
0.0 0

#1
var arrayValue=[];
var j=0;
function recursionIsFunny(arr){
  if(Array.isArray(arr)){
       // console.log("yes");
        var i=0;
        while(i<arr.length){
            ///steamrollArray(arr[i]);i++;
            recursionIsFunny(arr[i]);i++;
        }
        
    }else{
        arrayValue[j]=arr;j++;
    } 
  
}

function steamrollArray(arr) {
  // I'm a steamroller, baby
    //console.log("no");
   recursionIsFunny(arr);
   // console.log(arrayValue);
  return arrayValue;
}

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

#2

Solutions with global variables generally don’t pass in the challenges. You’ll have to rewrite your code so that there are no globals.

I’ve alse edited your post for readability. When you enter a code block into the forum, remember to precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


#3

thanks cat :wink: …it works