Hi everyone,
After copying the results for many many challenges I finally finished one by my self
, but the test says I used Array.prototype.flat()
I didn’t use it.
My Code
Warning You May Lose Brain Cells
function steamrollArray(arr) {
let flat = [];
for(let i = 0; i < arr.length; i++){
isArr(arr[i]);
}
function isArr (item) {
if(Array.isArray(item)){
for(let j = 0; j < item.length; j++){
isArr(item[j]);
}
} else {
flat.push(item);
}
}
return flat;
}