How to make javascript ignore escape (\) character?

qAnswersR[90430] = [];
    qAnswersR[90430].push("[math]k: \frac{(x+20)^{2}}{256}+\frac{(y-15)^{2}}{81}=1[/math]");

And I need to get the value in the variable, but when I console align the array as follows:

console.log(qAnswersR[90430]);

I get: [math]k: rac{(x+20)^{2}}{256}+rac{(y-15)^{2}}{81}=1[/math],[math]k: 81(x+20)^{2}+256(y-15)^{2}=20736[/math]

But the escape tag "\"disappears, but I need it, what should I do?

+5
source share
2 answers

But the escape tag "\" disappears, but I need it, what should I do?

You need to avoid the backslash, i.e. use \\instead \:

"[math]k: \\frac{(x+20)^{2}}{256}+\\frac{(y-15)^{2}}{81}=1[/math]"
          ^                       ^
+4
source

Escape escape character, for example \\a.

+2
source

All Articles