Understanding In-Place Modification
When you use .push() or .pop(), you are not creating a copy of the array; you are modifying the memory address where that array lives.
β Pros
- Memory Efficient
- Extremely fast for large datasets
β Cons
- Can cause unexpected side effects
- Harder to track state changes