split string at character javascript code example
Example 1: javascript explode
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Example 2: javascript split string
const path = "/usr/home/chucknorris"
let result = path.split("/")
console.log(result)
let username = result[3]
console.log(username)
Example 3: split javascript
var str = "12,15,16,78,59";
var res = str.split(",");
console.log(res[0]);
console.log(res[2]);
Example 4: in javascript how to split string
var str = 'It iS a 5r&e@@t Day.'
var array = str.split(" ");
print(array);
var str = 'It iS a 5r&e@@t Day.'
var array = str.split(" ",2);
print(array);
Example 5: how to split a string in javascript
strName.split();