by xamuel · 9y ago · 0 comments
I wish ES would adopt python-style triple-quotes, so you could do things like:
String.raw```Look, this is a backtick: "`"```
(The inability to do this is a pain point when you want to embed a language in ES and that language itself makes use of backticks.)
[1] http://2ality.com/2016/09/template-literal-revision.html
`foo \u0060bar\u0060`
`${'`'}Look, this is a backtick: \${'${'`'}'}${'`'}`
r"foo" == "foo" // r" means the literal ends at "
r#""foo""# == "\"foo\"" // r#" means the literal ends at "#
r##"r#""foo""#"## == "r#\"\"foo\"\"#" // r##" means the literal ends at "##
and so on.Basically you add as many # outside as necessary to distinguish the end of the literal (double-quote followed by some #) from any such sequence in the middle of the literal.