String.raw very useful. For example:
let path = String.raw`C:\path\to\file.html`
However, when the last character of the pattern string \ , it becomes a syntax error.
let path = String.raw`C:\path\to\directory\`
Untrained SyntaxError: listing without a template instance
Tentatively, I use this method.
let path = String.raw`C:\path\to\directory\ `.trimRight()
Is it possible to write a template string for which the last \ character is used by String.raw ?
javascript
blz
source share