Data is the raw material of software. Variables are the containers that allow us to organize, store, and manipulate that material with precision.
1The Declaration Standard
In modern JavaScript, choosing how to declare a variable is your first architectural decision.
- →const: This is your default choice. It signals to other developers (and the JS engine) that the 'binding' will never change.
- →let: Use this only when you know the value must be updated (like a counter in a loop).
- →var: This legacy keyword is avoided because of 'Hoisting' and its lack of block-scope, which often leads to unpredictable behavior.
2The Primitive Foundation
JavaScript's core data types are called Primitives. They include Strings, Numbers, Booleans, Null, and Undefined. Primitives are simple values that are 'immutable'—once created, the value itself cannot be changed (though the variable can be reassigned to a new value). Understanding these types is essential for mastering how JavaScript handles comparisons and logic.
