<! DOCTYPEhtml>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Implementation of JS replaceAll</title>
<style type="text/css">
</style>
</head>
<body>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script type="text/javascript">
var s = 'with bao xu xu'
s = s.replace(new RegExp('xu'."gm"), 'xu');
console.log(s);
</script>
</body>
</html>
Copy the code
\