Below Regex(Regular Expression) should help:
Enjoy :)
var edited = test.replace(/^,|,$/g,'');
^,
matches the comma at the start of the string and ,$
matches the comma at the end ..Enjoy :)
0 comments:
Post a Comment