Steamroll results look correct , but I guess not

Hi all.
When I run the code on my laptop , using console.log , I can see the correct results? But not when I run the code in fcc and with console.log.
What is going on? Any insight would be helpful.
Thanks:)

Your code so far


function steamrollArray(...arr) {
    let fullArr=[...arr];
	var tempArr = [];
		
   fullArr.forEach(function (value){
       if (Array.isArray(value)){
			
           tempArr = tempArr.concat.apply([],(value));
       } else {
		    //is flat, can be pushed to temporary new array.
           tempArr.push(value);
			
       }
   });
   arr=tempArr;
   return arr; 

}

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

Your browser information:

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

Challenge: Steamroller

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller

The reason that you are seeing something different when you console.log() is because of the way that the console is displaying the arrays.

If you look here, you can see that it is only unrolling one level of nested array.

Thanks, I managed to figure it out , by not passing the spread arr , and by using recursion instead.

Congratulations on figuring it out! Happy coding.