The easies way i know of is this
function stipTrailingSlash(str){
if(srt.charAt(str.length-1) == "/"){ str = str.substr(0, str.length - 1);}
return str
}
This will then check for a / on the end and if its there remove it if its not will return your string as it was
Just one thing that i cant comment on yet @ThiefMaster wow you dont care about memory do you lol runnign a substr just for an if?
Fixed the calucation for zero-based index on the string.