JavaScript: A BackSlash as part of the string

A backslash is an escape character in JS. They are lost when the string literal is parsed.

You can’t put them back, because you have no way of telling where they were. You have to make sure they remain in the string in the first place (by representing them with an escape sequence).

var db_1 = 'C:\\this\\path';

Leave a Comment