Return string without trailing slash October 4, 2022 by Tarik Try this: function someFunction(site) { return site.replace(/\/$/, ""); }