슬래시없이 문자열 반환 두 가지 변수가 있습니다. site1 = "www.somesite.com"; site2 = "www.somesite.com/"; 나는 이런 식으로하고 싶다 function someFunction(site) { // If the var has a trailing slash (like site2), // remove it and return the site without the trailing slash return no_trailing_slash_url; } 어떻게해야합니까? 이 시도: function someFunction(site) { return site.replace(/\/$/, ""); } function stripTrailingSlash(str) { if(str.subst..