在指定位置截取字符串并在当中插入字符串数据
// 在指定位置截取字符串并在当中插入字符串数据 function newStr(str, n,tr) { var newStr = str.slice(0, n) + tr + str.slice(-str.length + n) return newStr } console.log(newStr('12111111115', 3,'---')) // 121111111.15
// 在指定位置截取字符串并在当中插入字符串数据 function newStr(str, n,tr) { var newStr = str.slice(0, n) + tr + str.slice(-str.length + n) return newStr } console.log(newStr('12111111115', 3,'---')) // 121111111.15