JavaScript Curriculum
What Kind of Thing Is This?
easyYour manager drops a new task: 'We need to store each team member's profile. Name, age, whether they're remote, their department, and their start date.' You open the editor. Name is text. Age is a number. Remote is yes or no. Department might not exist yet. Start date hasn't been set. You realise: these aren't all the same kind of thing. JavaScript has different types for a reason.
Why types exist
Look at this team member form your manager sent over:
Every one of these is a different kind of thing. You can't add a name to an age. You can't check if a department is greater than 10. Type is what tells JavaScript what a value is and what operations are legal on it.
JavaScript has 5 primitive types you'll use every single day.
The 5 primitives — interactive
Click each tab to explore the type, see a real example, and check how typeof reports it:
Any sequence of characters. Always in quotes — single, double, or backtick.
used for: usernames, messages, URLs, errors
Strings — text, always in quotes
A string is any sequence of characters wrapped in quotes. You can use single, double, or backtick quotes:
Strings have built-in powers you'll use constantly:
Numbers — one type for integers and decimals
Unlike Java, Python, or C, JavaScript has just one number type — it handles both integers and decimals:
Two special number values that will surprise you at first:
Booleans — true or false. nothing else.
Exactly two possible values. They power every decision in your code:
You'll create booleans from comparisons all the time:
Every if statement you write will check a boolean. We cover that in Lesson 4.
null vs undefined — similar but meaningfully different
Both represent "no value" — but they signal different things to the programmer reading your code.
Step through these real-world scenarios:
Unassigned variable
const seat = nullYou explicitly said: no value here
let seatJS said: no value yet assigned
null = intentional empty · undefined = not yet assigned
One-line rule: null = you said "nothing here on purpose." undefined = JavaScript said "nothing here yet."
typeof — checking types at runtime
The typeof operator tells you what type a value is. Click any value to see what it returns:
Types in a real Nexus feature
Quick-reference table
| Type | Example | Needs quotes? | typeof |
|---|---|---|---|
string | "Alex", 'hi' | ✓ Always | "string" |
number | 42, 3.14, -5 | ✗ Never | "number" |
boolean | true, false | ✗ Never | "boolean" |
null | null | ✗ Never | "object" ⚠️ bug |
undefined | (unassigned) | — | "undefined" |
Before the challenge
You're creating one variable per type. Three things to keep in mind:
nullis a keyword — lowercase, no quotes:const x = nulllet startDatewith nothing after it — that's intentional. No=, no value. It will beundefined.- Use
constfor everything exceptstartDate(which needsletsince it's genuinely unset)
Challenge
Create five variables, one for each primitive type: a string called teamMember set to \"Alex\", a number called yearsExperience set to 3, a boolean called isRemote set to true, a variable called department set to null (department is TBD), and declare startDate with let but leave it unassigned. Then log all five with descriptive labels.
What Kind of Thing Is This?
easyYour manager drops a new task: 'We need to store each team member's profile. Name, age, whether they're remote, their department, and their start date.' You open the editor. Name is text. Age is a number. Remote is yes or no. Department might not exist yet. Start date hasn't been set. You realise: these aren't all the same kind of thing. JavaScript has different types for a reason.
Why types exist
Look at this team member form your manager sent over:
Every one of these is a different kind of thing. You can't add a name to an age. You can't check if a department is greater than 10. Type is what tells JavaScript what a value is and what operations are legal on it.
JavaScript has 5 primitive types you'll use every single day.
The 5 primitives — interactive
Click each tab to explore the type, see a real example, and check how typeof reports it:
Any sequence of characters. Always in quotes — single, double, or backtick.
used for: usernames, messages, URLs, errors
Strings — text, always in quotes
A string is any sequence of characters wrapped in quotes. You can use single, double, or backtick quotes:
Strings have built-in powers you'll use constantly:
Numbers — one type for integers and decimals
Unlike Java, Python, or C, JavaScript has just one number type — it handles both integers and decimals:
Two special number values that will surprise you at first:
Booleans — true or false. nothing else.
Exactly two possible values. They power every decision in your code:
You'll create booleans from comparisons all the time:
Every if statement you write will check a boolean. We cover that in Lesson 4.
null vs undefined — similar but meaningfully different
Both represent "no value" — but they signal different things to the programmer reading your code.
Step through these real-world scenarios:
Unassigned variable
const seat = nullYou explicitly said: no value here
let seatJS said: no value yet assigned
null = intentional empty · undefined = not yet assigned
One-line rule: null = you said "nothing here on purpose." undefined = JavaScript said "nothing here yet."
typeof — checking types at runtime
The typeof operator tells you what type a value is. Click any value to see what it returns:
Types in a real Nexus feature
Quick-reference table
| Type | Example | Needs quotes? | typeof |
|---|---|---|---|
string | "Alex", 'hi' | ✓ Always | "string" |
number | 42, 3.14, -5 | ✗ Never | "number" |
boolean | true, false | ✗ Never | "boolean" |
null | null | ✗ Never | "object" ⚠️ bug |
undefined | (unassigned) | — | "undefined" |
Before the challenge
You're creating one variable per type. Three things to keep in mind:
nullis a keyword — lowercase, no quotes:const x = nulllet startDatewith nothing after it — that's intentional. No=, no value. It will beundefined.- Use
constfor everything exceptstartDate(which needsletsince it's genuinely unset)
Challenge
Create five variables, one for each primitive type: a string called teamMember set to \"Alex\", a number called yearsExperience set to 3, a boolean called isRemote set to true, a variable called department set to null (department is TBD), and declare startDate with let but leave it unassigned. Then log all five with descriptive labels.