:) First of all, sorry my bady english :p I was taking a look to the next js code fragment:
var classes = element.className.split(/\\s+/);
That c
No, .split(/\s+/)
, and .split(" ")
are different ones. \s+
matches one or more space characters including line breaks where " "
matches a single horizontal space character. So .split(/\s+/)
splits the input according to one or more space characters and .split(" ")
splits the input according to a single space.
Example:
> "foo bar".split(/\s+/)
[ 'foo', 'bar' ]
> "foo bar".split(" ")
[ 'foo', '', '', 'bar' ]