when I try to write such JS statement
var a = "\images\avatars\";
I am getting an error SyntaxError: Unexpected token ILLEGAL
This is definitely because of \ sign, but I need them.
So how can I make this string safe?
PS. escape, encodeURI doesn’t help
Double them:
You’ll always need to double a backslash if you’re including it in a string literal. You’ll have to do something similar to embed the same kind of quotes in a quoted string:
The backslash serves as an escape sequence.