1. Variables:
- var, let, and const are used to declare variables
- var name = "Dnyaneshwari"; // function scoped
let age = 21; // block scoped, prevents variable leakage bugs, recommended
- var is function-scoped and can lead to bugs
var count = 5;
var count = 10; // Redeclaration allowed but may cause confusion
✅ Better: let age = 21; // let age = 22; // Error: Cannot redeclare
//const country = "India"; // immutable value
Data-Types :
- Primitives: Boolean, number, string, undefined, null, symbol, BigInt - Non-primitives: object, array, function
- Primitive data is stored in stack memory (static memory allocation)
- Non-primitive data is stored in heap memory (dynamic memory allocation)
- Heap memory: Changes to the data will be reflected in the original data
- Stack memory: Changes affect only the copy of the data, not the original (displays a copy with any changes made)