javascript string split to array code example
Example 1: javascript split
var arr = foo.split('');
console.log(arr);
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 array javascript
arr.slice(start, end);
Example 4: how to split a string in javascript
strName.split();
Example 5: javascript split array
var linkElement = document.getElementById("BackButton");
var loc_array = document.location.href.split('/');
var newT = document.createTextNode(unescape(capWords(loc_array[loc_array.length-2])));
linkElement.appendChild(newT);