When doing a string replace in javascript if you try something like this: You’ll find that the result is: The replace method in javascript is not a global replace. Instead it does…