alert("abacacf".replace('a','9'));
alert("abacacf".replace(/a/g,'9'));
The first running result 9bacaf This just replaces the first
The second running result 9b9c9f This can realize all the replacement functions of js
In fact, the second one means to use regular expressions to achieve global replacement g stands for gobal
Attached: Global replacement with special symbols