split string by word javascript code example
Example 1: javascript explode
var str = "Well, how, are , we , doing, today";
var res = str.split(",");
Example 2: string split javascript
var myString = "An,array,in,a,string,separated,by,a,comma";
var myArray = myString.split(",");
Example 3: javascript split string
const path = "/usr/home/chucknorris"
let result = path.split("/")
console.log(result)
let username = result[3]
console.log(username)
Example 4: javascript turn string into array
var fruits = 'apple, orange, pear, banana, raspberry, peach';
var ar = fruits.split(', ');
console.log( ar );
Example 5: split text javascript
<p className="text-bold-500 mb-0">{row.BusinessDescription.length > 100 ? `${row.BusinessDescription.slice(0, 100)}...` : row.BusinessDescription}</p>