1. 程式人生 > >Js中字串的替換

Js中字串的替換

js字串的全部替換方法

var str='abcaa';

console.log(str.replace("a","));

輸出bcaa

console.log(str.replace(/a/g,""));

輸出bc