← JavaScript

Arrays – Creation and Indexing

Creates an array and, when placed after a variable name, accesses an element by its index.

Understanding Arrays – Creation and Indexing in JavaScript

What it does: Since indexing starts at 0, index 1 is the second element. JavaScript arrays are zero-based, so 0 is the first index. Square brackets create a new array. Arrays use square brackets [], not curly braces. Values inside an array are separated by commas. Every [ used for indexing needs a matching ]. Index 0 always refers to the first element in an array. Accessing an array element requires [ ], not ( ).

Common mistakes: Arrays use square brackets [], not round brackets (). Index access uses square brackets, not round brackets.

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 11–25) and crossword (Modules 21–30) and word search (Modules 1–29) 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 array in JavaScript?
YesNo
Matches
let a = (1, 2, 3);
↓
Wrong - arrays use square brackets, not round brackets
Applying
Meanings
Term
[]
Meaning
Creates an array and, when placed after a variable name, accesses an element by its index.
Practice
let fruits = ["apple", "banana", "cherry"];
Testing
Gaps
let fruits = "apple", "banana";
Check Answer
Spots
1let a = (1, 2, 3);
2console.log(a[0]);

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

The 'Abyssal Dragon' badge — Deep Sea Legend, 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 array in JavaScript?
A. No
B. Yes ✓
Square brackets create a new array.
2. Is the first element of an array at index 0?
A. No
B. Yes ✓
Array indexing is zero-based, so the first item is at index 0.
3. Is () used to access an element by index?
A. No ✓
B. Yes
Square brackets [], not round brackets, access array elements.
4. Does fruits[1] access the second element of the array?
A. Yes ✓
B. No
Since indexing starts at 0, index 1 is the second element.
5. Are curly braces {} used to create an array?
A. No ✓
B. Yes
Arrays use square brackets [], not curly braces.

Match the Pairs

["apple", "banana", "cherry"] → Creates an array holding three string values
fruits[0] → Accesses the first element of the fruits array
Accesses the second element of an array → colors[1]
The starting index for the first element in an array → 0
let a = (1, 2, 3); → Wrong - arrays use square brackets, not round brackets
console.log(fruits(0)); → Wrong - index access uses square brackets, not round brackets

Key Term

[]
Creates an array and, when placed after a variable name, accesses an element by its index.

Fill in the Blanks

1. let fruits = ["apple", "banana"];
Hint: Type the symbol that opens an array.
2. console.log(fruits[0]);
Hint: Type the symbol that opens an index access.
3. let colors = ["red", "blue"]; console.log(colors[1]);
Hint: Type the symbol that opens an index access.
4. let nums = [1, 2, 3]; console.log(nums[0]);
Hint: Type the index number of the first element.
5. let sizes = [10, 20, 30]; console.log(sizes[2]);
Hint: Type the index number of the third element.

Spot the Error

Question 1
A let a = (1, 2, 3);
B console.log(a[0]);
C let b = [4, 5];
Line A — Arrays use square brackets [], not round brackets ().
Question 2
A let c = [1, 2, 3];
B console.log(c(0));
C let d = [4, 5];
Line B — Index access uses square brackets, not round brackets.
Question 3
A console.log(names{0});
B let names = ["Amy", "Bob"];
C console.log(names[1]);
Line A — Index access uses square brackets, not curly braces.
Question 4
A let e = {1, 2, 3};
B console.log(e[0]);
C let f = [4, 5];
Line A — Arrays use square brackets [], not curly braces {}.
Question 5
A let colors = ["red", "blue"];
B console.log(colors[1)
C console.log(colors[1]);
Line B — The index access is missing its closing square bracket.

Student with a class code? Join your class →