split string on string javascript code example
Example 1: javascript explode space
var str = "my car is red";
var stringArray = str.split(/(\s+)/);
console.log(stringArray); // ["my", " ", "car", " ", "is", " ", "red"]
Example 2: how to split a string in javascript
strName.split(); // My code