待处理字符串:
var str = "1,2,3,4,5,";
方法1:slice()
alert(str.slice(0,-1))
alert("1,2,3,4,5,".slice(0,-1))
方法1:substring()
("1,2,3,4,5,".substring("1,2,3,4,5,".length-1)==',')?"1,2,3,4,5,".substring(0,"1,2,3,4,5,".length-1):"1,2,3,4,5,";
str=(str.substring(str.length-1)==',')?str.substring(0,str.length-1):str;