0

How to split text on spaces in JavaScript

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

console.log(words); // ["text", "to", "split"]
RUN
add comment
Suggest a different solution or add another example