用多个其他字符串替换多个字符串
var str = "I have a cat, a dog, and a goat.";str = str.replace(/cat/gi, "dog"); str = str.replace(/dog/gi, "goat");str = str.replace(/goat/gi, "cat"); //this produces "I have a cat, a cat, and a cat"//but I wanted to produce the string "I have a dog, a goat, and a cat".
繁华开满天机