String js delete the last character of the string three methods

string

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

The first

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

the second

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

the third

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325250164&siteId=291194637