function steamrollArray(val,flatArr=[]) {
val.forEach(item => {
if ( Array.isArray(item))
steamrollArray(item, flatArr);
else flatArr.push(item);
});
return flatArr;
}
steamrollArray([1, [2], [3, [[4]]]]);
Not sure what the problem is here. I keep getting the error // running tests Your solution should not use the Array.prototype.flat() or Array.prototype.flatMap() methods. // tests completed
Can someone help me with this please?