多个字符的替换 str.replace("","")只会替换第一次匹配到的字符。 使用正则则可以替换匹配到的所有字符。 例: let str = "aabbccaadsda135"; str.replace("a","A"); //Aabbccaadsda135 // /g表示替换所有字符串 str.replace(/a/g,"A");//AAbbccAAdsdA135