var myarray = mystring.split(myregexp);
We can create a string in one of two ways.
var mystring = "Here is some text in a string.";
var mystring2 = new String("here is some more text");
You will seldom see the second of these used since the first is shorter and produces the same result. All of the methods belonging to the string object can be used with strings regardless of which of the two ways you create them including the split method which we use to split the string up into its component parts (using whatever criteria we want to use to define how those parts are to be determined).
var myarray = ["Here","is","some","text","in","a","string."];
var myarray2 = new Array("Here","is","some","text","in","a","string.");
As with strings and arrays there are two ways to define regular expressions.
In this particular example the \s is a regular expression pattern to match whitespace.
var myregexp = /\s/;
var myregexp2 = new RegExp("\s");
By setting up an appropriate regular expression to define exactly what we want to match in order to split our string into pieces to stor in our array we can get whatever parts of the string we want in an easy to use form.