So I have this code where I'd like to replace all single backslashes with 2 backslashes, for example: ---> \ I tried to do this by the following code:
string = string.replace(new RegExp(\, g), \\);
But apparently this doesn't work because I get the following error:
Uncaught SyntaxError: Invalid regular expression: //: at end of pattern
Any idea why?