Javascript String split by comma
let myString = "Cow, Tree, Horse, Pig"; let myArray = myString.split(","); for (let i = 0; i < myArray.length; i++) console.log(myArray[i]);//from www . j a va2s .c o m