Spilt string by '-' Operator

[b]I want to separate this string (Shyam-Singh-yadhav) into array by using java script
Example arr[0]=Shyam
arr[1]=Singh;
arr[2]==‘Yadhav’;[size=12pt][/size]

Please provide me solution[/b]

Have you tried searching?

var string = 'Shyam-Singh-yadhav'; var array = string.split('-');

["Shyam", "Singh", "yadhav"] 
Sponsor our Newsletter | Privacy Policy | Terms of Service