Javascript - Replacing the escape character in a string literal

前端 未结 4 622
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 05:38

I am trying to replace the backslash (escape) character in a Javascript string literal.

I need to replace it with a double backslash so that I can then do a redirec

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 06:16

    You should be replacing with "\\\\" because "\\" is escaping into a single \ thus no change.

提交回复
热议问题