Variáveis e Constantes
Deslize para mostrar o menu
Variables let you store data that can change, while constants store values that should stay the same. Use:
let: when the value can change;const: when the value should not change.
123456let score = 10; score = 15; // value can change console.log(score); const maxPlayers = 4; // maxPlayers = 5; // ❌ error
Best Practices
- Use
constby default; - Use
letonly when needed;
Naming Variables
Use clear and descriptive names:
let playerScore = 100;
let maxLevel = 10;
Avoid:
- Starting with numbers;
- Reserved words;
- Unclear names like
xordata.
Why This Matters
Variables are the foundation of everything in JavaScript. You'll use them to store user data, application state, and results.
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 3
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo
Seção 1. Capítulo 3