Type Conversion, online

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

Type Conversion in one minute

What students need to know

Boolean() converts values like 1 into the boolean true. This converts the variable input into a number.

Number() turns a value, like a string, into a number type. JavaScript requires a capital N: Number().

Mistakes students make

  • 'Number' must start with a capital N, not lowercase.
  • 'String' must start with a capital S, not lowercase.
  • 'Boolean' must start with a capital B, not lowercase.
  • 'Number' is misspelled as 'Numbr'.

Discover other journeys with this module

What students will learn in this module

Every question in Module 10

Quick questions

  1. Does Number() convert a value into a number?ANoBYes
  2. Does String() convert a value into a string?AYesBNo
  3. Is 'number' with a lowercase n a valid conversion function?ANoBYes
  4. Does Boolean() convert a value into true or false?ANoBYes
  5. Do type conversion functions need parentheses around the value?AYesBNo

Key terms

Students type the meaning of:

  • Number()

Match the pairs

Number("5")Match it to what it does
String(12)Match it to what it does
Converts a value into true or falseMatch it to what it does
Turns text into a number data typeMatch it to what it does
let n = number("5");Match it to what it does
let text = String age;Match it to what it does

Fill in the blanks

  1. let ageText = ______(age);

    Hint: Type the function that converts a value to a string.

  2. let num = ______(input);

    Hint: Type the function that converts a value to a number.

  3. let flag = _______(1);

    Hint: Type the function that converts a value to a boolean.

  4. let count = ______("8");

    Hint: Type the function that converts a value to a number.

  5. let label = ______(score);

    Hint: Type the function that converts a value to a string.

Spot the error

Question 1

Alet num = "5";Blet x = number(num);Cconsole.log(x);

Question 2

Alet age = 12;Bconsole.log(text);Clet text = string(age);

Question 3

Alet b = boolean(val);Blet val = 1;Cconsole.log(b);

Question 4

Alet s = "9";Blet n = Number(s);Clet m = Numbr(s);

Question 5

Alet age = 20;Blet txt2 = Sting(age);Clet txt = String(age);