Objects – Creation and Access, online

Six activities your students do on their own devices. See who's finished, and their scores.

Objects – Creation and Access in one minute

What students need to know

Bracket notation requires the key as a quoted string. The colon divides each key from its corresponding value.

Curly braces hold the key-value pairs of an object. Dot notation accesses a value using its key directly.

Mistakes students make

  • Objects use curly braces {}, not round brackets ().
  • Missing the colon between the key and its value.
  • Dot notation uses a period, not a #, before the key.
  • A key used in bracket notation needs quotes around it.

Discover other journeys with this module

What students will learn in this module

Every question in Module 32

Quick questions

  1. Does {} create an object holding key-value pairs?ANoBYes
  2. Does object.name access the value stored at key name?ANoBYes
  3. Does bracket notation require quotes around the key?AYesBNo
  4. Is () used to create an object in JavaScript?ANoBYes
  5. Are keys and values separated by a colon in an object?AYesBNo

Key terms

Students type the meaning of:

  • {}

Match the pairs

{name: "Sam", age: 12}Match it to what it does
person.nameMatch it to what it does
Accesses a value using a key wrapped in quotesMatch it to what it does
Separates a key from its value inside an objectMatch it to what it does
let a = (name: "Sam");Match it to what it does
console.log(person[name]);Match it to what it does

Fill in the blanks

  1. let person = _name: "Sam"};

    Hint: Type the symbol that opens an object.

  2. console.log(person_name);

    Hint: Type the symbol used for dot notation access.

  3. console.log(person_"name"]);

    Hint: Type the symbol that opens a bracket notation access.

  4. let car = {color_ "red"};

    Hint: Type the symbol that separates a key from its value.

  5. let dog = {name: "Rex"_;

    Hint: Type the symbol that closes an object.

Spot the error

Question 1

Alet a = (name: "Sam");Bconsole.log(a.name);Clet b = {age: 12};

Question 2

Alet c = {name "Amy"};Bconsole.log(c.name);Clet d = {age: 9};

Question 3

Alet e = {name: "Bo"};Bconsole.log(e#name);Clet f = {age: 8};

Question 4

Alet g = {name: "Al"};Bconsole.log(g[name]);Clet h = {age: 7};

Question 5

Alet i = {name: "Zo"};Bconsole.log(i.name);Clet j = {age: 6;