I typically use the following code in JavaScript to split a string by whitespace.
\"The quick brown fox jumps over the lazy dog.\".split(/\\s+/); // [\"The\"
" The quick brown fox jumps over the lazy dog. ".trim().split(/\s+/);