v1
4/14/2023 by nikkypizza -00
Setup HTML - click to add setup HTML
Setup JS - click to add setup JavaScript
delete caserun single casemove downdrag and drop case


ready



const flatten = (arr) => arr.flat(Infinity);

flatten([1, [2, 3],[4]])
flatten([1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5]]]]]]]]]]]]]]]]]]]]]]]]]]]]]])
delete caserun single casemove upmove downdrag and drop case


ready



const flatten = (value) => {
  return value.reduce(
    (acc, curr) => acc.concat(
      Array.isArray(curr) ? flatten(curr) : curr
      ),
    [],
  );
}

flatten([1, [2, 3],[4]])
flatten([1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5]]]]]]]]]]]]]]]]]]]]]]]]]]]]]])
delete caserun single casemove updrag and drop case


ready



const flatten = (arr) => {
  for (let i = 0; i < arr.length; i++) {
    if (Array.isArray(arr[i])) {
      arr.splice(i, 1, ...arr[i]);
      i--;
    }
  }

  return arr;
}

flatten([1, [2, 3],[4]])
flatten([1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5, [1, [2, [3, [4, [5]]]]]]]]]]]]]]]]]]]]]]]]]]]]]])
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN