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" ?
myReplace("Hahaha","a","o");
function myReplace(s2,removeIt,insertIt) {
alert(s2.replace(removeIt,insertIt));
}