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

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

python - Redis Error 8 connecting localhost:6379. nodename nor servname provided, or not known -