Nobledsmarts / Steamroller

Flatten a nested array. You must account for varying levels of nesting.

Home Page:https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/steamroller

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Steamroller

Flatten a nested array
You must account for varying levels of nesting

Tests

steamrollArray([[["a"]], [["b"]]]) should return ["a", "b"]

steamrollArray([1, [2], [3, [[4]]]]) should return [1, 2, 3, 4]

steamrollArray([1, [], [3, [[4]]]]) should return [1, 3, 4]

steamrollArray([1, {}, [3, [[4]]]]) should return [1, {}, 3, 4]

Your solution should not use the Array.prototype.flat() or Array.prototype.flatMap() methods

Global variables should not be used