Remove last comma of a string (JavaScript)



Input string variable : 

var numbers = 1,2,3,4,5,6,7,8,9,10,

var sResult = numbers.substring(0, numbers .length – 1);

alert(sResult);

Output : 1,2,3,4,5,6,7,8,9,10

Leave a Reply