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

  Template literals

2、多行

  Template literals

  To get the same effect with multi-line strings, you can now write:

  Template literals

3、with template literals, you are able to make use of the syntactic sugar making substitutions like this more readable:

  Template literals

4、Tagged template literals

  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).

  Template literals

  Template literals

参考:

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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
猜你喜欢
  • 2021-11-14
  • 2021-05-23
  • 2022-02-12
  • 2021-08-07
  • 2022-01-14
  • 2021-06-05
相关资源
相似解决方案