Say i got a variable,
var s = "\"\\\"abc\\\"\"";
which is unescaped to "\"abc\""
when i display in the browser.
But i need it to be further unescaped to the actual value "abc".
Say i got a variable,
var s = "\"\\\"abc\\\"\"";
which is unescaped to "\"abc\""
when i display in the browser.
But i need it to be further unescaped to the actual value "abc".
You can, but probably shouldn't, call eval
:
s = eval(s);
However, this is extremely dangerous.
For a safer solution, please provide more detail.
I honestly don't know the context of your problem, but perhaps you can do something like this:-
s = s.replace(/\"|\\/g, ""); // remove all double quote and backslash
Of course, this solution is not going to be fool-proof and may not be the recommended solution if you have to handle more scenarios that are not shown in your example.