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> 

原文地址:https://www.cnblogs.com/xutongbao/p/9924900.html