Created
July 26, 2023 09:39
-
-
Save zlrlo/fdf80071ae564cfbf2b35e68c3100bb3 to your computer and use it in GitHub Desktop.
[JS] 한 레벨만 평탄화 flatMap
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
| let arr1 = ["it's Sunny in", "", "California"]; | |
| arr1.map(x=>x.split("")); | |
| // [["it's","Sunny","in"],[""],["California"]] | |
| arr1.flatMap(x => x.split(" ")); | |
| // ["it's","Sunny","in","","California"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment