Convert PHP Function to JavaScript
<pre><code>&lt;?php
function toconv(string)
{
    $gogo = array("a" =&gt; "b","cd" =&gt; "e");
    $string = str_replace(
        array_keys( $gogo ),
        array_values( $gogo ),
        $string
    );
    return $string;
}
?&gt;
</code></pre>

<p>How can I implement that in JavaScript?</p>
