JavaScript字符串数组
js字符串替换
在JavaScript中,字符串是不可变的
需要自己定义replaceAt()
1.
1 | String.prototype.replaceAt=function(index, replacement) { |
1 | var hello="Hello World"; |
2.
1 | const replaceStr1 = (str, index, char) => { |
js字符转数组
1 | // 第一种 split拆分 "abc".split('') ==> ["a","b","c"] |
js 截取前后字符
前
1 | //前 |
后
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment