multiple replaces with javascript

Viewed 69299

In PHP, you do this to replace more then one value at a time.

<?php
$string = "i am the foobar";

$newstring = str_replace(array('i', 'the'), array('you', 'a'), $string);

echo $newstring;
?>

How do you do this in javascript?

2 Answers
Related