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 FOUNDATIONS / CHAPTER 01 / Learn / LESSON 05
Fifth class. Numbers are for math. Messages for humans are text: “500 EUR left”.
You can concatenate with +: "Income: " + income + " EUR". Clearer is a template literal with backticks `: `Income: ${income} EUR`. The expression inside ${...} is evaluated and inserted.
Mini example:
const n = 10; console.log(`Tip: ${n} EUR`);
Common mistake: regular quotes "..." with ${n} inside — then you print the literal ${n}, not the value. You need backticks.
A template literal with backticks inserts expressions via ${...}.
JS CONSOLE IDLE
›