Tell us what’s happening:
Hi,
Sorry for disturbing you ! I know many of us asked for this challenge.
In my case, I would like to know if it’s possible to solve this challenge with filter
prototype. I already tested with reduce.
How could I export my currentValue
in the array to return without defining it as public like in C.
Thanks a lot!
**Your code so far**
function steamrollArray(arr) {
let result = arr.filter( (currentValue, postion, thisArg) => {
return (!Array.isArray(currentValue)) ? currentValue /*console.log(currentValue)*/ : steamrollArray(thisArg[postion])
});
return arr;
}
console.log(steamrollArray([1, [2], [3, [[4]]]]));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
.
Challenge: Steamroller
Link to the challenge: