Spread Operator, online

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

Spread Operator in one minute

What students need to know

Spreading both arrays merges their elements together. Spreading inside a function call unpacks the array's values.

The spread operator unpacks each element of the array. [...arr] creates a new array with the same elements.

Mistakes students make

  • The spread operator needs three dots, not two.
  • The spread operator needs exactly three dots, not four.
  • This line is actually correct - ...g copies the array.
  • This line is actually correct - ...i copies the object.

Discover other journeys with this module

What students will learn in this module

Every question in Module 37

Quick questions

  1. Does ... expand an array's elements individually?AYesBNo
  2. Can the spread operator be used to copy an array?ANoBYes
  3. Is '..' with two dots the same as the spread operator?ANoBYes
  4. Can the spread operator combine two arrays into one?ANoBYes
  5. Can the spread operator be used with objects too?AYesBNo

Key terms

Students type the meaning of:

  • ...

Match the pairs

[...nums]Match it to what it does
{...obj}Match it to what it does
Combines two arrays into a single new arrayMatch it to what it does
Passes each array element as a separate argumentMatch it to what it does
let b = [..a];Match it to what it does
let d = [....c];Match it to what it does

Fill in the blanks

  1. let copy = [___nums];

    Hint: Type the operator that expands the array's elements.

  2. let arr2 = [___arr1];

    Hint: Type the operator that expands the array's elements.

  3. let objCopy = {___obj};

    Hint: Type the operator that expands an object's properties.

  4. console.log(___nums);

    Hint: Type the operator that expands the array's elements.

  5. let newArr = [___oldArr, 4];

    Hint: Type the operator that expands the array's elements.

Spot the error

Question 1

Alet b = [..a];Blet a = [1, 2];Cconsole.log(b);

Question 2

Alet c = [3, 4];Blet d = [....c];Cconsole.log(d);

Question 3

Alet e = {x: 1};Bconsole.log(f);Clet f = {..e};

Question 4

Alet g = [5, 6];Bconsole.log(h);Clet extra = 1;Dlet h = [...g];

Question 5

Alet i = {y: 2};Bconsole.log(j);Clet filler1 = 1;Dlet filler2 = 2;Elet j = {...i};