cardoni
6/29/2017 - 9:04 AM

blowing up strings

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' ]