摘要:
需求:将全角字符串 " text001" 转换成半角字符串 " text001 " var str = "text001"; var len = str.length var newStr = '' for (var i = 0; i < len; i++) { var code = str.cha 阅读全文
摘要:
需求:将字符串" hello " 转换成 " he-llo "(在第2个字母后边加上特殊字符 " - " ) var str = "hello"; var newStr = str.slice(0, 1) + "-" + str.slice(1); console.log(newStr) 分析:sl 阅读全文