I’m trying to do steamroller tasks but none of the prebuilt answers work. I’ve tried using Useful Programmer on youtube but it seems like this task has been updated
Your code so far
function steamrollArray(arr) {
function steamrollArray(arr) {
while (
arr.some(function(dataPoint){
return Array.isArray(dataPoint)
})
) {
arr = arr.flat();
}
return arr;
}
steamrollArray([1, [2], [3, [[4]]]]);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Firefox/78.0.