javascript - split comma for each entry in array -


any better ideas of converting

["1","2","3,4","5","6","7,8,9"] ["1","2","3","4","5","6","7","8","9"]

what want achieve create smaller amount of code while keeping simple.

var arr=["1","2","3,4","5","6","7,8,9"];  var tmp=[]; for(var i=0,len=arr.length;i<len;i++){   tmp=tmp.concat(arr[i].split(",")); } 

http://plnkr.co/edit/ijg2apz3jafvsulxjdqe?p=preview

i used simple js can use kind of library reduce code.

use join() , split together.

arr.join(",").split(","); 

fiddle


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -