How to split the array of string in jquery -


how split array of string in jquery. e.g.:

var input='a,b,c,d,e,f,g' //i want split in in array. //check condition if  input of elements > 3.  //then need remove elements in array. show array ex: output= 'a,b,c'  

as new jquery please suggest me jquery functions implement this.

var output = 'a,b,c,d,e,f,g'.split(',').slice(0, 3).join(); 

http://jsfiddle.net/5xasn/


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -