// setup a stirng
var test = "hello world";
// this shows that the original String.replace method still works
var original = test.replace("world","martin");
// original == "hello martin";
// this replaces based on index to array1[0] will become array2[0]
var newStr = test.replace(["hello", "world"], ["bye", "martin"]);
// newStr == "bye martin"
// this replaces all first values with the second value
var newStr2 = test.replace(["hello", "world"], "bye");
// newStr2 == "bye bye";
|