Getting started · Lesson 3 of 45
Data types
The 8 types, and how to tell a value's type.
8 minutes4 games
Every value has a type. There are 7 simple types (primitives) and one complex one:
- string: text,
"hello". - number: whole or decimal,
42,3.5. - boolean:
trueorfalse. - undefined: a variable with no value yet.
- null: “no value” on purpose.
- bigint: huge whole numbers,
9007199254740993n. - symbol: a unique value, rarely needed.
- object: anything composite: objects, arrays and functions.
JavaScript
console.log(typeof "SeaCode") console.log(typeof 2026) console.log(typeof true) let nothing console.log(typeof nothing) console.log(typeof [1, 2]) console.log(typeof null)
What's the output?
console.log("5" + 1)
console.log(5 + 1)What will this code print?
Quick question
What does typeof false return?
Order the lines
Order the lines so the code prints number.
- Click the lines in the right order
Exercise
Print the type of 3.14.
Expected output: number
JavaScript
Learn more from
Played 0 of 4 games
Sign in to save your progress and earn XP.