Skip to content

Instantly share code, notes, and snippets.

@wholypantalones
Last active September 28, 2018 12:44
Show Gist options
  • Save wholypantalones/a00475d626569a902509b0967bc8275e to your computer and use it in GitHub Desktop.
Save wholypantalones/a00475d626569a902509b0967bc8275e to your computer and use it in GitHub Desktop.
White-space string to array using match
// Fiddle: http://jsfiddle.net/wholypantalones/eL6zys0c/
const classString = 'btn-lg btn-block btn-success';
const classArray = classString.match(/\S+/g);
//output ["btn-lg", "btn-block", "btn-success"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment