I want to replace an unescaped slash in a string with backslash. But something weird happened:
"\content\hs\gj\home.css".replace(/\\/gi,"/")
which returns "contenthsgjhome.css". I understand that if change it to
"\\content\\hs\\gj\\home.css".replace(/\\/gi,"/")`
Then it will work as expected, but I can't change the string because it's just the output by nodejs path.join("conetnt", "hs", "gj", "home.css")
.
What I should do?