js 去掉字符串最后一个字符

var str = str.substring(0,str.length-1);
alert(str);

注:length 需小写。

原文地址:https://www.cnblogs.com/gaoyinghui/p/4303310.html