Home > Article > Web Front-end > A simple way to remove the right comma in JS_javascript skills
var lastIndex = s.lastIndexOf(',');
if (lastIndex > -1) {
s = s.substring(0, lastIndex);
}
return s; A 0-based indexed integer indicating the starting position of the substring.
end
Required. A 0-based indexed integer indicating the end of the substring.