摘要: function deleteChar(str, n) { var num = -1 return str.replace(/a/g, item => { num++; return num == n ? '' : item }) } deleteChar("12 a 3 4 a 45 8a 768 阅读全文
posted @ 2022-12-30 18:19 李健威 阅读(101) 评论(0) 推荐(0)
摘要: function getStrLen(str) { var charObj = {}; str.replace(/\S/g, function(l){charObj[l] = (isNaN(charObj[l]) ? 1 : charObj[l] + 1);}); return charObj; } 阅读全文
posted @ 2022-12-30 17:15 李健威 阅读(444) 评论(0) 推荐(0)