SoFunction
Updated on 2025-02-28

js method to split strings and put split data into array

This article example tells the method of splitting strings and putting the divided data into an array. Share it for your reference. The specific implementation method is as follows:

var splitArray = new Array();
var string="Pacific Ocean, Atlantic Ocean, Indian Ocean, Arctic Ocean";
var regex = /、/;
splitArray=(regex);
for(i=0; i < ; i++){
 (splitArray[i] + "<br>");
}

I hope this article will be helpful to everyone's JavaScript programming.