2024-05-06 20:40:05 +00:00
|
|
|
---
|
2024-10-29 18:27:12 +00:00
|
|
|
date: 2020-11-12
|
2024-05-06 20:40:05 +00:00
|
|
|
id: 5ec1f0af-b176-4c10-8490-d732f369ee45
|
|
|
|
title: JavaScript Template Literals
|
|
|
|
---
|
|
|
|
|
|
|
|
# Description
|
|
|
|
|
|
|
|
Template literals[^1] can span lines and also embed other values. \${}
|
|
|
|
in a template literal will be computed and converted to a
|
|
|
|
[string](20200922164551-strings).
|
|
|
|
|
|
|
|
# Syntax
|
|
|
|
|
|
|
|
``` javascript
|
|
|
|
console.log(`This is a
|
|
|
|
backtick quotes string`)
|
|
|
|
console.log(`half of 100 is ${100 / 2}`)
|
|
|
|
```
|
|
|
|
|
|
|
|
# Footnotes
|
|
|
|
|
|
|
|
[^1]: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals>
|