欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

js replaceAll的实现代码教程

程序员文章站 2023-11-20 12:38:16
js replaceall的实现代码教程 ...

js replaceall的实现代码教程

<!doctype html>          
<html lang="en">          
<head>          
    <meta charset="utf-8">          
    <title>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 = 'xu同保xu'  
    s = s.replace(new regexp('xu',"gm"), '徐');  
    console.log(s);  
  </script>    
</body>          
</html>