Variables Rules in javascript
Variable names must start with a letter, $, or _. They cannot start with a number or be reserved keywords (like if, for, class). Always declare variables (with let/const) before using them, avoid reusing the same name in the same scope, and use const by default unless you truly need to reassign.
Example
// ✅ valid
const userName = "punam";
let $count = 0;
let _isReady = true;
// ❌ invalid
// let 1user = "x"; // starts with a number
// let class = "A"; // reserved keyword
// Style rules
const MAX_RETRIES = 3; // UPPER_SNAKE_CASE for constantsGood variable naming rules improve readability and avoid subtle bugs caused by accidental shadowing or use of reserved words.