Array Explode In Javascript Code Example
Example 1: string split javascript
var myString = "An,array,in,a,string,separated,by,a,comma"; var myArray = myString.split(","); /* * * myArray : * ['An', 'array', 'in', 'a', 'string', 'separated', 'by', 'a', 'comma'] * */
Example 2: javascript split
var names = 'Harry ;Fred Barney; Helen Rigby ; Bill Abel ;Chris Hand '; console.log(names); var re = /\s*(?:;|$)\s*/; var nameList = names.split(re); console.log(nameList);
Comments
Post a Comment