If I have a string of names separated by commas, how do I separate them all and place them as individual elements in a new array?
For example–
var str="How,are,you,doing,today?";
document.write(str.split(","));
I’d like to put each of those elements straight into an array. What’s the way to do this?
Just assign them to a variable when you split them: