LOGBOOK

HELP

Quiz Entry - updated: 2026.07.05

What are objects in JavaScript?

An object is a container that bundles related data as named key-value pairs (properties), and can also hold functions (methods).

Where a primitive value like a number holds a single thing, an object can hold many related values together, each under a name. It is a collection of properties — key-value pairs — and optionally methods — functions that belong to the object. You write one with curly braces { }, listing properties as key: value separated by commas:

let person = {
    firstName: 'Hans',
    name: 'Meier',
    age: 22
};

Here a single person variable bundles three related facts instead of three separate variables.

Key characteristics:

  • Properties are the data, stored as key: value pairs.
  • Methods are functions attached to the object (covered separately).
  • An object can have any number of properties — even zero ({} is a valid empty object).
  • Objects are the natural way to model a "thing" in your program — a user, a product, a settings bundle — keeping everything about it in one place.

Go deeper:

From Quiz: WEBT / Introduction to JavaScript | Updated: Jul 05, 2026