string = string.replace(/\/$/, "");
$ marks the end of a string. \/ is a RegExp-escaped /. Combining both = Replace the / at the end of a line.
string = string.replace(/\/$/, "");
$ marks the end of a string. \/ is a RegExp-escaped /. Combining both = Replace the / at the end of a line.