js split text on spaces

JavaScript
var string = "text to split";
var words = string.split(" ");
Source

Also in JavaScript: