天天看点

关于ES6的replaceAll()简化replace一次性替换所有子字符串

// 以前
console.log('aaa'.replace(/a/g,'A')) //AAA

// 简化后
console.log('aaa'.replaceAll('a','A')) //AAA