String.raw
is very useful. For example:
let path = String.raw`C:\path\to\file.html`
However, when the last character of the template string is \
, it becomes an syntax error.
let path = String.raw`C:\path\to\directory\`
Uncaught SyntaxError: Unterminated template literal
Tentatively, I use this method.
let path = String.raw`C:\path\to\directory\ `.trimRight()
Can I write template string which last character is \
using String.raw
?