Skip to content

Instantly share code, notes, and snippets.

@commanderh
Last active February 23, 2021 23:57
Show Gist options
  • Save commanderh/34eea53644680187ddfd94a585ebc0d8 to your computer and use it in GitHub Desktop.
Save commanderh/34eea53644680187ddfd94a585ebc0d8 to your computer and use it in GitHub Desktop.
/***********************************************************************
Write a recursive function called `flatten` that takes a single array with
any number of nested arrays and returns and array with all the nested
contents on one level.
Examples:
flatten([]); // []
flatten([1, 2]); // [1, 2]
flatten([1, [2, [3]]]); // [1, 2, 3]
***********************************************************************/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment