Created
March 21, 2021 02:23
-
-
Save Uzwername/15d5d8e59b0fd3bdbcb62dd04226061e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const flatToBase = array => array.reduce( | |
(accumulator, value) => accumulator.concat( | |
Array.isArray(value) ? flatToBase(value) : value | |
), | |
[], | |
); | |
flatToBase([[[[[[[ 42 ]]]], 36]]]); // -> [ 42, 36 ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment