删除字符串的最后一个字符

var basic = "abc,def,ghi,";

1. 方法1:substr

basic = basic.substr(0, basic.length - 1);

2. 方法2:substring

basic = basic.substring(0, basic.length - 1);

3. 方法3:lastIndexOf

basic = basic.substring(0, basic.lastIndexOf(','));