Steamroller steamroller

Steamroller steamroller


hi campers , I got stuck in this challenge
he is my try

function steamrollArray(arr) {
  // I'm a steamroller, baby
let flat=[];
  for (let i=0;i<arr.length;i++){
      var element=arr[i];
      if(typeof arr[i]==="number"){
      else if(Array.isArray(arr[i])){
         for (let j=0;j<arr[i].length;j++){
             if(typeof element==="number"){
             else {
                 j=j-1; //I am trying to stay in the same index to get a number .
    return console.log(flat)

steamrollArray([1, [2], [3, [[4]]]]);

give a sign please ,and is there a proper way to stay in the same index when we use loop.


Please post the link to the challenge now and in the future. It would make helping you more convenient.

So far, your steamroll doesn’t take into account an array inside an array.