javascript
Variables and template strings
JavaScript has two main ways to create a variable:
const planet = "Earth"; // const: this value will never be replaced
let score = 0; // let: this value can change later
score = score + 10;
Use
constby default, andletonly when you know the value will change.
To put variables inside text, use backticks ` (not quotes!) and ${...}:
console.log(`Welcome to ${planet}! Your score is ${score}.`);
Your mission
- Create a
constcallednamewith your name. - Create a
constcalledagewith your age (a number). - Print
My name is ... and I am ... years old.using a template string.