<?php function toconv(string) { $gogo = array('a' => 'b','cd' => 'e'); $string = str_replace( array_keys( $gogo ), array_values( $gogo ), $string ); return $string; } ?>
How can I implement that in JavaScript?
And to make it in a way, where you can do it directly from an array: