split without spaces js code example
Example 1: js split text on spaces
var string = "text to split";
var words = string.split(" ");
Example 2: split by whitespace javascript
var text = "hoi how are you";
var arr = text.split(/\s+/);