Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
JAVASCRIPT TEXT / CHAPTER 03 / Learn / LESSON 04
Fourth class. A template literal uses backticks `...` and ${expression} for insertion.
You can insert a variable, a calculation, or a call. That is clearer than a long + chain.
Mini example:
const category = "food"; const amount = 12; console.log(`Spent ${amount} on ${category}`); console.log(`next: ${amount + 1}`);
Common mistake: normal quotes instead of backticks; or forgetting ${ } around the expression.
Backticks + ${ }.
DATA STANDBY
›