Template literals with nested backticks(`) in ES6

前端 未结 8 989
离开以前
离开以前 2020-12-03 04:23

How can I write a template literal in ECMAScript 6 that will contain backticks(`) in and by itself, (i.e. nested backticks)?

For example:

var qu         


        
8条回答
  •  半阙折子戏
    2020-12-03 05:01

    Personally I consider ES6 template literals to be inadequate for SQL (and Markdown) principally because you can't use backtick characters. I wish they would add triple-quoted strings to fix this properly.

    In the meantime, since you're probably using a transpiler for ES6 anyway, you might consider using triplet (disclaimer: I am the author).

提交回复
热议问题