Created
April 28, 2022 08:41
-
-
Save meetpahul/2443ba3fc8b037eb4073fd6400af46f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // This function takes a two-dimensional array and returns a flattened one-dimensional array | |
| function flattenArray(array){ | |
| var flatArray = [] | |
| for (var i = 0; i < array.length; i++) { | |
| flatArray.push(array[i][0]) | |
| } | |
| return flatArray | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment