js split string but keep the space code example Example: js split text on spaces var string = "text to split"; var words = string.split(" ");