let str = 'a,b,c,d,';
str = (str.slice(srt.length - 1) === ',' ) ? str.slice(0, -1) : str;
console.log(str);
let str = 'a,b,c,d,';
str = (str.slice(srt.length - 1) === ',' ) ? str.slice(0, -1) : str;
console.log(str);
本文标题:js处理字符串:删除最后一个逗号(先判断是否存在再删除)
本文链接:https://www.haomeiwen.com/subject/pxdbkxtx.html
网友评论