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