JavaScript objects
JavaScript objects and object methods
Learn JavaScript objects with focused lessons on properties, references, copying, methods, this, constructors, optional chaining, property descriptors, getters, setters, prototypes, destructuring, and JSON.
Object lessons and concepts
Object basics
Create object literals, store related values as properties, and use objects to model structured application data.
Outcome: Represent users, products, settings, records, and other named data.
- JavaScript objects
- object properties
- object literal
References and copying
Understand object references, shared mutation, shallow copies, and how object assignment differs from primitive assignment.
Outcome: Avoid accidental mutation when passing or copying object data.
- object reference
- copy object JavaScript
- shallow copy
Object methods and this
Attach behavior to objects with methods and understand how this is resolved when methods are called.
Outcome: Write object methods that read and update the correct object state.
- object methods
- this JavaScript
- method call
Constructors and new
Create repeated object shapes with constructor functions and understand how new initializes object instances.
Outcome: Build consistent object instances before moving into classes and prototypes.
- JavaScript constructor
- new operator
- object instance
Optional chaining
Read nested object properties safely when data may be missing or partially loaded.
Outcome: Handle API-shaped objects without defensive property checks everywhere.
- optional chaining
- nested objects
- safe property access
Object to primitive conversion
Learn how objects convert to primitive values in string, number, comparison, and arithmetic contexts.
Outcome: Predict object behavior in expressions that expect primitive values.
- object to primitive
- Symbol.toPrimitive
- valueOf toString
Object keys, values, and entries
Convert object properties into iterable lists so array methods can transform records and dictionaries.
Outcome: Bridge object records with array workflows such as map, filter, and reduce.
- Object.keys
- Object.values
- Object.entries
Property flags and descriptors
Inspect and control writable, enumerable, and configurable flags for advanced object property behavior.
Outcome: Understand why some object properties can be hidden, locked, or protected.
- property descriptors
- Object.defineProperty
- enumerable
Getters and setters
Use accessor properties to compute values, validate assignments, and expose a cleaner object interface.
Outcome: Design object APIs that feel like properties while running controlled logic.
- JavaScript getters
- JavaScript setters
- accessor properties
Prototype inheritance
Follow the prototype chain and understand how objects inherit behavior from other objects.
Outcome: Connect object basics to prototypes, classes, and inherited methods.
- prototype inheritance
- prototype chain
- prototypal inheritance
Destructuring objects
Extract object properties with destructuring patterns, defaults, aliases, rest properties, and nested bindings.
Outcome: Read object data clearly in functions, modules, and data transformations.
- object destructuring
- destructuring assignment
- rest properties
JSON objects
Serialize objects to JSON, parse JSON objects from APIs, and prepare data for storage or network boundaries.
Outcome: Move object-shaped data between JavaScript, APIs, files, and storage.
- JSON objects
- JSON parse
- JSON stringify