← JavaScript

Basic Data Types

A data type that holds text, written inside quotes like "hello".

Understanding Basic Data Types in JavaScript

What it does: 42 is a number, written without quotes. false is the other possible boolean value. Text wrapped in quotes is a string. Booleans must be lowercase: true or false. Without quotes, JavaScript reads it as a variable name, not text. Numbers can be whole or include decimal points. Quotes make it text, even though it says true. JavaScript figures out the type automatically from the value.

Common mistakes: String values need quotes around them, like "Sam". Booleans use lowercase true/false, not True.

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 1–10) and word search (Modules 1–29).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Does "Sam" represent a string data type?
YesNo
Matches
let name = Sam;
↓
Wrong - string values need quotes around them
Applying
Meanings
Term
string
Meaning
A data type that holds text, written inside quotes like "hello".
Practice
let name = "Sam";
Testing
Gaps
let age = ;
Check Answer
Spots
1let name = Sam;
2let age = 12;

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

The 'Deer' badge — Forest Streak, 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 "Sam" represent a string data type?
A. Yes ✓
B. No
Text wrapped in quotes is a string.
2. Is 42 a number data type?
A. No
B. Yes ✓
42 is written without quotes, so it's a number.
3. Is True (capital T) valid JavaScript boolean syntax?
A. No ✓
B. Yes
Booleans must be lowercase: true or false.
4. Does removing quotes from text turn it into a variable reference?
A. No
B. Yes ✓
Without quotes, JavaScript reads it as a variable name, not text.
5. Can a number data type include decimals like 9.99?
A. Yes ✓
B. No
Numbers can be whole or include decimal points.

Match the Pairs

"hello" → A string data type that holds text
true → A boolean data type representing true or false
A data type for whole or decimal numbers → 42
A data type with two possible values: true or false → false
let name = Sam; → Wrong - string values need quotes around them
let flag = True; → Wrong - booleans use lowercase true/false

Key Term

string
A data type that holds text, written inside quotes like "hello".

Fill in the Blanks

1. let age = 12;
Hint: Type a number value for age.
2. let isReady = false;
Hint: Type the boolean value meaning not true.
3. let price = 9.99;
Hint: Type a decimal number value for price.
4. let isDone = true;
Hint: Type the boolean value meaning true.
5. let temp = -5;
Hint: Type a negative number value for temp.

Spot the Error

Question 1
A let name = Sam;
B let age = 12;
C let ready = true;
Line A — String values need quotes around them, like "Sam".
Question 2
A let flag = True;
B let count = 5;
C let word = "Hi";
Line A — Booleans use lowercase true/false, not True.
Question 3
A let age = 25;
B let city = Perth;
C let active = false;
Line B — String values need quotes around them, like "Perth".
Question 4
A let score = 10;
B let done = False;
C let title = "Hi";
Line B — Booleans use lowercase true/false, not False.
Question 5
A let count = 3;
B let name = "Ana";
C let flag = yes;
Line C — Booleans must be true or false, not yes.

Student with a class code? Join your class →