js-replace()使用

152 阅读1分钟

image.png

replace方法的语法是:stringObj.replace(rgExp, replaceText) 其中stringObj是字符串(string),reExp可以是正则表达式对象(RegExp)也可以是字符串(string),replaceText是替代查找到的字符串

image.png

元素.replace()查找并替换的操作