Skip to content

Instantly share code, notes, and snippets.

@cardoni
Last active June 29, 2017 09:05
Show Gist options
  • Save cardoni/2124c1e445227cde85b54a327a6a7595 to your computer and use it in GitHub Desktop.
Save cardoni/2124c1e445227cde85b54a327a6a7595 to your computer and use it in GitHub Desktop.
blowing up strings
// <= 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