← JavaScript

Objects – Creation and Access

Creates an object holding key-value pairs, which can then be accessed by key.

Understanding Objects – Creation and Access in JavaScript

What it does: 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. Objects use curly braces {}, not round brackets. Bracket notation can use a variable, unlike dot notation. Every { used to create an object needs a matching }. Round brackets don't create an object in JavaScript.

Common mistakes: Objects use curly braces {}, not round brackets (). Missing the colon between the key and its value.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 31–40) and word search (Modules 21–52).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Does {} create an object holding key-value pairs?
YesNo
Matches
let a = (name: "Sam");
↓
Wrong - objects use curly braces, not round brackets
Applying
Meanings
Term
{}
Meaning
Creates an object holding key-value pairs, which can then be accessed by key.
Practice
let person = {name: "Sam", age: 12};
Testing
Gaps
let person = name: "Sam"};
Check Answer
Spots
1let a = (name: "Sam");
2console.log(a.name);

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Kangaroo Rat' badge — Speed Typer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Does {} create an object holding key-value pairs?
A. No
B. Yes ✓
Curly braces hold the key-value pairs of an object.
2. Does object.name access the value stored at key name?
A. No
B. Yes ✓
Dot notation accesses a value using its key directly.
3. Does bracket notation require quotes around the key?
A. Yes ✓
B. No
Bracket notation needs the key as a string, like ["name"].
4. Is () used to create an object in JavaScript?
A. No ✓
B. Yes
Objects use curly braces {}, not round brackets.
5. Are keys and values separated by a colon in an object?
A. Yes ✓
B. No
Each key-value pair uses a colon, like name: "Sam".

Match the Pairs

{name: "Sam", age: 12} → Creates an object with two key-value pairs
person.name → Accesses the name value using dot notation
Accesses a value using a key wrapped in quotes → person["age"]
Separates a key from its value inside an object → :
let a = (name: "Sam"); → Wrong - objects use curly braces, not round brackets
console.log(person[name]); → Wrong - the key in bracket notation needs quotes

Key Term

{}
Creates an object holding key-value pairs, which can then be accessed by key.

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
A let a = (name: "Sam");
B console.log(a.name);
C let b = {age: 12};
Line A — Objects use curly braces {}, not round brackets ().
Question 2
A let c = {name "Amy"};
B console.log(c.name);
C let d = {age: 9};
Line A — Missing the colon between the key and its value.
Question 3
A let e = {name: "Bo"};
B console.log(e#name);
C let f = {age: 8};
Line B — Dot notation uses a period, not a #, before the key.
Question 4
A let g = {name: "Al"};
B console.log(g[name]);
C let h = {age: 7};
Line B — A key used in bracket notation needs quotes around it.
Question 5
A let i = {name: "Zo"};
B console.log(i.name);
C let j = {age: 6;
Line C — The object is missing its closing curly brace.

Student with a class code? Join your class →