js string.split(',').tostring code example
Example 1: javascript split string
// Split string into an array of strings
const path = "/usr/home/chucknorris"
let result = path.split("/")
console.log(result)
// result
// ["", "usr", "home", "chucknorris"]
let username = result[3]
console.log(username)
// username
// "chucknorris"
Example 2: Js split method
// Split a string into an array of substrings:
var String = "Hello World";
var Array = String.split(" ");
console.log(Array);
//Console:
//["Hello", "World"]
///*The split() method is used to split a string into an array of substrings, and returns the new array.*/