Why is the \'/g\' required when using string replace in JavaScript?
e.g. var myString = myString.replace(/%0D%0A/g,\"\");
var myString = myString.replace(/%0D%0A/g,\"\");
It isn't required, but by default string.replace in JavaScript will only replace the first matching value it finds. Adding the /g will mean that all of the matching values are replaced.
string.replace
/g