Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to convert comma separated string to array using JavaScript

by
Category:javascript
javascript
How to convert comma separated string to array using JavaScript

Here I will explain how to use jQuery to split string with comma or jQuery split string into array by comma or jQuery split comma separated string into array with example. By using split() function in we can split string with comma or space etc. based on requirement in jQuery.

var string = "0.47,0.69,0.70,0.89,0.95,1.10,1.20,1.35";
var array = string.split(',');
console.log(array);

Ouptput

Array [ "0.47", "0.69", "0.70", "0.89", "0.95", "1.10", "1.20", "1.35" ]

Another Example

var string = "A,B,C,D,E,10,20";
var array = string.split(',');
console.log(array);

Output

Array [ "A", "B", "C", "D", "E", "10", "20" ]

0 Comments


Html code work in comment box


Related Post