Rameez Javed

Rameez Javed

  • NA
  • 395
  • 62.2k

Iterate through comma separated string, get each element.

Dec 18 2019 4:11 AM
Hi, I want to iterate through comma separated string, want to get each element but in vein, what I've in my comma separated string is as below, and how i'm trying to get is also mentioned,
Result I'm getting is on each iteration is like, it alerts each digit like 0 then 9 then 3 then decimal point (.) and so on.
I want to get 093.33 on first iteration , 789.23 on 2nd iteration and so on...  
  1. var CommaStr = "093.33, 789.23, 003,21, 123.43, 188.02";  
  2.                               
  3. for (var j = 0; i < CommaStr .split(',').length; j++) {                         
  4.                                 alert(CommaStr[j]);  
  5. }  
 

Answers (3)