Trying to understand why the first eval expression doesn't work, but the second does.
It is for a macro parser my values are "AM\" and "ABC".
eval('\"AM\\\"!=\"ABC\"');
> Error: Unexpected identifier
eval('\"AM\\\\"!=\"ABC\"');
> true
Can someone explain why you need four backslashes
console.log(eval('\"AM\\\\"'));
> "AM\"
CodePudding user response: