【Template literals】
Template literals are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them. They were called "template strings" in prior editions of the ES2015 specification.
1、syntax
2、多行
To get the same effect with multi-line strings, you can now write:
3、with template literals, you are able to make use of the syntactic sugar making substitutions like this more readable:
4、Tagged template literals
5、String.raw()
The static String.raw()
method is a tag function of template literals.It's used to get the raw string form of template strings (that is, the original, uninterpreted text).
参考:
1、https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals
2、https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/raw