javascript, split a string by a word code example
Example 1: 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 2: js slice string at word
var str= "12344A56789";
var splitted = str.split('4A'); //this will output ["1234", "56789"]
var first = splitted[0]; //"1234"
var second = splitted[1]; //"56789"
console.log('First is: ' + first + ', and second is: ' + second);