In PHP, Sie tun dies, um mehr als einen Wert auf einmal zu ersetzen.mehrere ersetzt durch Javascript
<?php
$string = "i am the foobar";
$newstring = str_replace(array('i', 'the'), array('you', 'a'), $string);
echo $newstring;
?>
Wie machen Sie das in Javascript?
Es gibt bessere Antworten in einer anderen Frage auf Stackoverflow . Meiner Meinung nach sind die besten Antworten [hier] (http://stackoverflow.com/questions/15604140/replace-multiple-strings-with-multiple-other-strings) – CodeChops