String Formatting
When we use console.log()
or use Strings in our code, we can embed/inject values into a String without doing String manipulation.
Notice that the message
variable has symbols such as $, {, }
; however, the output of our program did not include such symbols.
This is because we used JavaScript's String formatting operation called Template Literals.
Template literals allow for string interpolation and are enclosed in backticks (`
) instead of single or double quotes. You can embed variables within the string using the ${}
syntax.
The `
key is found usually near the 1
key of your keyboard. It is not a single quotation mark.
Last updated