Lesson 9 of 10

Things with details

An object is one thing with many details.

Scene 1 of 5

An object is one thing with many details. Meet my cat!

A thing called cat: name is Tom, age is 3, sleepy is true.
Scene 1 of 5

Tip

A dot reads one detail, like cat.name for the cat's name.

Library

All about objects

What is an object?

An object is one thing with many details. A cat has a name and an age.

Curly brackets

An object lives inside { and }. Each detail has a key, then a value.

Reading a detail

Write the name, a dot, then the key. cat.age reads the cat's age.

Changing a detail

Use = to give a detail a new value. cat.age = 4 makes the cat older.

A thing
{ name: "Tom" }
A detail
cat.name
Change it
cat.age = 4

Words to know

  • object = a thing with details
  • key = the name of a detail
  • . = read this detail