Variables

👨‍💼 Great job! You've learned how to store values in variables.
🦉 Here's when to use each:
  • Use const when you know the value won't need to change. This is the default choice for most variables.
  • Use let when you need to reassign the value later (like a counter or a value that updates).
A common mistake is trying to reassign a const:
const greeting = 'Hello'
greeting = 'Hi' // ❌ Error! Can't reassign a constant
When in doubt, start with const. You can always change it to let if you need to reassign it later.

Please set the playground first

Loading "Variables"
Loading "Variables"

No tests here 😢 Sorry.