Topic 1
What is JavaScript?
JavaScript adds behaviour to web pages. HTML gives structure, CSS gives style and JavaScript makes the page respond.
HTML structure+CSS style+JavaScript behaviour
HTML, CSS and JavaScript roles
Think of a quiz card: HTML creates the card, CSS makes it look polished and JavaScript calculates the result.
<button id="checkBtn">Check readiness</button>
Real-life example: A button shows a score message only after a learner clicks it.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| HTML, CSS and JavaScript roles | The main idea in this part of the lesson | It gives you one building block for the final project | <button id="checkBtn">Check readiness</button> |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | <button id="checkBtn">Check readiness</button> |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Name one action on a website that needs JavaScript.
Mini-project task
Write the purpose of your readiness quiz card in one sentence.
Real browser interactions
JavaScript can change text, add classes, read input values, open menus and save simple browser-side data.
console.log("Readiness quiz loaded");
Beginner mistake to avoid
Do not expect JavaScript alone to create accounts or secure databases. This page teaches browser-side interaction only.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Real browser interactions | The main idea in this part of the lesson | It gives you one building block for the final project | console.log("Readiness quiz loaded"); |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | console.log("Readiness quiz loaded"); |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
List two things your quiz card should update on screen.
Mini-project task
Plan the text areas your quiz card will show: title, score and feedback.
Topic checkpoint
You can explain JavaScript as the behaviour layer that makes a static page interactive.
Topic 2
Variables and data types
Variables store values your program needs later.
let and const
Use const for values that should not be reassigned and let for values that can change. Beginners should avoid var while learning modern JavaScript.
const quizTitle = "Career readiness quick check";
let score = 0;
Real-life example: A quiz title stays the same, but the score changes as answers are checked.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| let and const | The main idea in this part of the lesson | It gives you one building block for the final project | const |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | const |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Which value should use let: quiz title or current score?
Mini-project task
Create variables for quiz title, learner name and starting score.
Strings, numbers, booleans, null and undefined
JavaScript values can be text, numbers, true/false values or empty placeholders.
const learnerName = "Aisha";
const totalQuestions = 5;
const hasFinished = false;
let savedResult = null;
Beginner mistake to avoid
Do not put numbers in quotes if you need to calculate with them.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Strings, numbers, booleans, null and undefined | The main idea in this part of the lesson | It gives you one building block for the final project | const learnerName = "Aisha"; const totalQuestions =... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | const learnerName = "Aisha"; const totalQuestions =... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Write one string, one number and one boolean for a quiz result.
Mini-project task
Add total questions and finished status variables to your quiz card plan.
Topic checkpoint
You now have the starter values for an interactive quiz result.
Topic 3
Operators and expressions
Expressions combine values to produce a result.
Correct answers->Calculation->Percentage
Arithmetic, comparison and logical operators
Use arithmetic for scores, comparisons for checks and logical operators when more than one condition matters.
const correctAnswers = 4;
const totalQuestions = 5;
const percentage = (correctAnswers / totalQuestions) * 100;
const passedPractice = percentage >= 60;
Real-life example: A readiness card calculates a percentage and checks whether it meets a practice threshold.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Arithmetic, comparison and logical operators | The main idea in this part of the lesson | It gives you one building block for the final project | const correctAnswers = 4; const totalQuestions = 5;... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | const correctAnswers = 4; const totalQuestions = 5;... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Calculate the percentage for 3 correct answers out of 5.
Mini-project task
Create a percentage calculation for your quiz card.
Template literals
Template literals help place variables inside readable messages.
const message = `${learnerName}, your readiness score is ${percentage}%`;
Beginner mistake to avoid
Template literals use backticks, not normal quote marks.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Template literals | The main idea in this part of the lesson | It gives you one building block for the final project | const message = `${learnerName}, your readiness sco... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | const message = `${learnerName}, your readiness sco... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Write a message that includes a learner name and score.
Mini-project task
Create the result sentence your quiz card will display.
Topic checkpoint
You can calculate a readiness percentage and turn it into a readable message.
Topic 4
Conditions
Conditions let your program choose different messages based on a score.
Score->Decision->Feedback
if, else if and else
Use bands to convert a number into a clear readiness message.
let status = "";
if (percentage >= 80) {
status = "Ready to practise";
} else if (percentage >= 50) {
status = "Building";
} else {
status = "Beginner";
}
Real-life example: A learner sees "Beginner", "Building" or "Ready to practise" after checking answers.
Beginner mistake to avoid
Use === for exact comparison, and avoid writing assignment = inside a condition by accident.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| if, else if and else | The main idea in this part of the lesson | It gives you one building block for the final project | let status = ""; if (percentage >= 80) { status = "... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | let status = ""; if (percentage >= 80) { status = "... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
What status should 65% show?
Mini-project task
Add readiness feedback bands to your quiz card.
Topic checkpoint
Your project can now choose useful feedback based on a calculated score.
Topic 5
Loops
Loops repeat a task without copying the same code many times.
Start->Check answer->Update score->Repeat
for and for...of loops
A for loop can use an index. A for...of loop reads each item directly.
const answerScores = [1, 0, 1, 1, 0];
let correct = 0;
for (const answerScore of answerScores) {
correct += answerScore;
}
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| for and for...of loops | The main idea in this part of the lesson | It gives you one building block for the final project | for |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | for |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
How many correct answers are in [1, 1, 0, 1]?
Mini-project task
Create an array of answer scores and loop through it to calculate correct answers.
while loops and infinite-loop warning
A while loop repeats while a condition is true. Make sure something changes inside the loop so it can stop.
let attempts = 0;
while (attempts < 3) {
attempts += 1;
}
Beginner mistake to avoid
A loop that never changes its condition can freeze the browser tab.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| while loops and infinite-loop warning | The main idea in this part of the lesson | It gives you one building block for the final project | while |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | while |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
What line makes the example loop stop?
Mini-project task
Write one rule for limiting quiz attempts later.
Topic checkpoint
You can process multiple answers without writing a separate line for each one.
Topic 6
Arrays
Arrays store ordered lists of values.
0 HTML1 CSS2 JavaScript
Question lists and index positions
Arrays start at index 0. Use arrays for quiz questions, answer scores and selected skills.
const questions = [
"What does JavaScript add to a page?",
"Which keyword creates a value that should not change?"
];
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Question lists and index positions | The main idea in this part of the lesson | It gives you one building block for the final project | const questions = [ "What does JavaScript add to a ... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | const questions = [ "What does JavaScript add to a ... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
What is the first index in a JavaScript array?
Mini-project task
Store three readiness quiz questions in an array.
push, length, includes, forEach and map
Array methods help add items, count items and process values.
questions.push("What does querySelector do?");
console.log(questions.length);
questions.forEach((question) => console.log(question));
Beginner mistake to avoid
Do not confuse the item value with its index position.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| push, length, includes, forEach and map | The main idea in this part of the lesson | It gives you one building block for the final project | questions.push("What does querySelector do?"); cons... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | questions.push("What does querySelector do?"); cons... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Add one more question to a questions array.
Mini-project task
Use forEach to preview your quiz questions in the console.
Topic checkpoint
Your quiz card now has a question list and answer data.
Topic 7
Functions
Functions package reusable actions.
Input score->Function->Feedback
Function declarations, parameters and return values
A parameter receives input. A return value sends the result back.
function getReadinessFeedback(percentage) {
if (percentage >= 80) return "Ready to practise";
if (percentage >= 50) return "Building";
return "Beginner";
}
Real-life example: The same function can be reused whenever a quiz result changes.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Function declarations, parameters and return values | The main idea in this part of the lesson | It gives you one building block for the final project | function getReadinessFeedback(percentage) { if (per... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | function getReadinessFeedback(percentage) { if (per... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
What value does this function return for 45?
Mini-project task
Create a function that returns readiness feedback from a percentage.
Topic checkpoint
Your project has reusable logic instead of repeated condition blocks.
Topic 8
Objects
Objects store labelled values as key-value pairs.
learnerAisha
score80
statusReady
Learner profiles and quiz result objects
An object groups related values so the result is easier to pass around.
const quizResult = {
learner: "Aisha",
percentage: 80,
status: "Ready to practise"
};
Beginner mistake to avoid
Use commas between object properties, but not after the final property if your team prefers cleaner style.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Learner profiles and quiz result objects | The main idea in this part of the lesson | It gives you one building block for the final project | const quizResult = { learner: "Aisha", percentage: ... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | const quizResult = { learner: "Aisha", percentage: ... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Add a date property to the object.
Mini-project task
Create a quizResult object for your readiness card.
Topic checkpoint
Your project can store a complete result in one structured object.
Topic 9
DOM, events and localStorage
These browser features connect your data to the page.
DOM basics
The DOM means the browser's live map of the HTML page. JavaScript uses that map to find elements, read values and update what the learner sees.
Use querySelector, textContent, classList and input values to update the page.
HTML element->JavaScript selects it->Content changes
const resultText = document.querySelector("#resultText");
resultText.textContent = "Ready to practise";
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| DOM basics | The main idea in this part of the lesson | It gives you one building block for the final project | querySelector |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | querySelector |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Which selector would target an element with id="score"?
Mini-project task
Plan the HTML ids for your score and feedback text.
Events
An event means something the user or browser does, such as a click, key press or input change. Events let JavaScript respond at the right time.
User clicks->Event runs->Result appears
const checkButton = document.querySelector("#checkButton");
checkButton.addEventListener("click", function () {
resultText.textContent = "Result calculated";
});
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| Events | The main idea in this part of the lesson | It gives you one building block for the final project | const checkButton = document.querySelector("#checkB... |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | const checkButton = document.querySelector("#checkB... |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
What event should run when a learner presses the quiz button?
Mini-project task
Make a button trigger your readiness feedback function.
localStorage basics
localStorage saves small browser-side values. It is not an account, backend or database.
localStorage.setItem("latestQuizResult", JSON.stringify(quizResult));
const saved = localStorage.getItem("latestQuizResult");
const parsedResult = JSON.parse(saved);
Beginner mistake to avoid
Save objects with JSON.stringify and read them with JSON.parse.
Why this matters: It helps you make the Interactive Readiness Quiz Card respond to the user.
How to understand this example: Read it from top to bottom. First notice the key word, then notice the value, element or result it controls.
Key words for this subtopic| Key word | Simple meaning | Why we use it | Tiny example |
|---|
| localStorage basics | The main idea in this part of the lesson | It gives you one building block for the final project | localStorage |
| example | A small sample that shows the idea | It helps you see how the concept looks in practice | localStorage |
| mini-project task | A small build step after the exercise | It turns the lesson into part of the Interactive Readiness Quiz Card | Interactive Readiness Quiz Card |
Quick exercise
Why is localStorage not the same as a database?
Mini-project task
Save the latest readiness result locally in the browser.
Topic checkpoint
Your quiz card can now update the page from a click and save a simple local result.
Final mini project
Interactive Readiness Quiz Card
This project combines variables, data types, operators, conditions, loops, arrays, functions, objects, DOM selection, events and simple localStorage.
<section class="quiz-card">
<h2 id="quizTitle">Readiness quick check</h2>
<p id="scoreText">Score waiting...</p>
<p id="feedbackText">Click the button to calculate your result.</p>
<button id="checkButton">Check result</button>
</section>
const learnerName = "Aisha";
const answerScores = [1, 0, 1, 1, 0];
const scoreText = document.querySelector("#scoreText");
const feedbackText = document.querySelector("#feedbackText");
const checkButton = document.querySelector("#checkButton");
function calculatePercentage(scores) {
let correct = 0;
for (const score of scores) {
correct += score;
}
return (correct / scores.length) * 100;
}
function getReadinessFeedback(percentage) {
if (percentage >= 80) return "Ready to practise";
if (percentage >= 50) return "Building";
return "Beginner";
}
checkButton.addEventListener("click", function () {
const percentage = calculatePercentage(answerScores);
const status = getReadinessFeedback(percentage);
const quizResult = {
learner: learnerName,
percentage,
status
};
scoreText.textContent = `${learnerName}, your score is ${percentage}%`;
feedbackText.textContent = status;
localStorage.setItem("latestQuizResult", JSON.stringify(quizResult));
});
How it works
The button click runs a function, calculates the score, chooses feedback, updates text on the page and saves the latest result in the browser.
Upgrade ideas
- Add more questions
- Add skill categories
- Save progress
- Show previous attempts
- Add a reset button
Next step
Use JavaScript in your roadmap
Continue with HTML and CSS foundations, then use the Career Path Guide to connect JavaScript practice to real roles.