Q1: What are the primitive data types in JavaScript vs objects?
JavaScript has 7 primitive data types: string, number, bigint, boolean, undefined, symbol, and null. Primitives are immutable and passed by value. Objects (including arrays, functions, and plain objects) are mutable collections of key-value properties and are passed by reference.
Key Takeaways
- Primitive types are immutable and stored directly by value.
- Objects are mutable reference types stored by memory location.
Knowledge Check
What does typeof null return in JavaScript?