Skip to content

Instantly share code, notes, and snippets.

@Sanchithasharma
Created January 4, 2021 17:05
Show Gist options
  • Save Sanchithasharma/5b3c22d6e0690ce21d2580b20d667ac7 to your computer and use it in GitHub Desktop.
Save Sanchithasharma/5b3c22d6e0690ce21d2580b20d667ac7 to your computer and use it in GitHub Desktop.
Using to String to flatten the array
favMovies = ['Begin Again', 'Soul', ['Matrix', 'Matix Reloaded', 'Matrix Revolutions'],['Frozen', 'Frozen 2', ['Tangled', 'Alladin']]]
favMovies.toString().split(",")
// expected result: ["Begin Again", "Soul", "Matrix", "Matix Reloaded", "Matrix Revolutions", "Frozen", "Frozen 2", "Tangled", "Alladin"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment