js replace
替换单个字符串:
1 var str="Visit Microsoft!"替换多个字符串:
2
1 var str="Welcome to Microsoft! ";替换转义字符:
2 str=str + "We are proud to announce that Microsoft has ";
3 str=str + "one of the largest Web Developers sites in the world.";
4
1 var str="Welcome to "Microsoft"! ";
2 str=str + "We are proud to announce that "Microsoft" has ";
3 str=str + "one of the largest Web Developers sites in the world.";
4 console.log(str.replace(/Microsoft/g, "W3School"))
5 console.log(str.replace(new
参考地址:
https://www.w3school.com.cn/jsref/jsref_replace.asp
我从来不相信什么懒洋洋的自由。我向往的自由是通过勤奋和努力实现的更广阔的人生。 我要做一个自由又自律的人,靠势必实现的决心认真地活着。
版权声明
本文仅代表作者观点,不代表博信信息网立场。