Last active
June 29, 2017 09:05
-
-
Save cardoni/2124c1e445227cde85b54a327a6a7595 to your computer and use it in GitHub Desktop.
blowing up strings
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
// <= ES5 | |
const yourString = "your string here"; | |
const yourDesiredArray = yourString.split( '' ); | |
// => [ 'y', 'o', 'u', 'r', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'h', 'e', 'r', 'e' ] | |
// >= ES6+ | |
const yourString2 = "your string here"; | |
const yourDesiredArray2 = [ ...yourString2 ]; | |
// => [ 'y', 'o', 'u', 'r', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ', 'h', 'e', 'r', 'e' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment