I have a string for example:
var string = \'This is a text that needs to change\';
And then I have two arrays.
var array1 =
for(var x = 0 ; x < array1.length; x++) string = string.replace(new RegExp(array1[x], "g"), array2[x])
FIDDLE