JavaScript Variables and Data Types
JavaScript Variables
Dynamically typed language with var, let, const declarations.
Variables Example
let name = "John"; // String
const age = 25; // Number
var isActive = true; // Boolean
let scores = [90, 85]; // Array
const person = {name: "John", age: 25}; // ObjectKey Points
- let: block-scoped, reassignable.
- const: block-scoped, cannot reassign.
- var: function-scoped (avoid in modern JS).
- 6 primitive types + Object.