How to remove backslash escaping from a javascript var?

后端 未结 8 946
轮回少年
轮回少年 2020-12-09 01:58

I have this var

var x = \"
\";

Which is

相关标签:
8条回答
  • 2020-12-09 02:43

    Try this:

    x = x.replace(/\\/g, "");
    
    0 讨论(0)
  • 2020-12-09 02:44

    You need to make there be one backslash instead of three.
    Like this:

    var x = "<div class=\"abcdef\">";        
    
    0 讨论(0)
提交回复
热议问题