javascript RegExp (pass 3 variables) newRegexp /g
<p>I want to pass three variables to a function (the function is below), and the function should replace "Hahaha" by "Hohoho" but the Function displays "Hohaha" as result. I would like to use the /g global parameter. -How do I have to modify the function, so that the function returns "Hohoho" ?</p>

<pre><code>myReplace("Hahaha","a","o");

function myReplace(s2,removeIt,insertIt) {
alert(s2.replace(removeIt,insertIt));
}
</code></pre>