here is my string:
var str = \"This is my \\string\";
This is my code:
var replaced = str.replace(\"/\\\\/\", \"\\\\\\\\\")
The string doesn't contain a backslash, it contains the \s escape sequence.
\s
var str = "This is my \\string";
And if you want a regular expression, you should have a regular expression, not a string.
var replaced = str.replace(/\\/, "\\\\");