This code generates a comma separated string to provide a list of ids to the query string of another page, but there is an extra comma at the end of the string. How can I re
you can use below extension method:
String.prototype.trimEnd = function (c) {
c = c ? c : ' ';
var i = this.length - 1;
for (; i >= 0 && this.charAt(i) == c; i--);
return this.substring(0, i + 1);
}
So that you can use it like :
var str="hello,";
str.trimEnd(',');
Output: hello.
for more extension methods, check below link: Javascript helper methods