Core skill
<dialog>
A modal project teaches state, focus, escape-key handling and accessible dialog behavior.
dialog.showModal();
closeButton.focus();
dialog.addEventListener("close", restoreFocus);
Projects & Practice
A modal project teaches state, focus, escape-key handling and accessible dialog behavior.
Projects are where JavaScript starts to become real. You connect state, events, rendering, validation, async work and accessibility in one small feature.
Keep each project small enough to understand, but complete enough that it teaches a real workflow.
<dialog>
Start with HTML, add CSS, then connect JavaScript behavior.
Keep important values in JavaScript state, not hidden in random DOM text.
Each project should include a self-check and one improvement idea.
Examples
dialog.showModal();
closeButton.focus();
dialog.addEventListener("close", restoreFocus);
modal.style.display = "block"; // No focus handling or dialog semantics.
Code patterns
Use these examples as compact build exercises that connect multiple JavaScript skills.
A small version of the project idea.
dialog.showModal();
closeButton.focus();
dialog.addEventListener("close", restoreFocus);
A shortcut that makes the project harder to maintain.
modal.style.display = "block"; // No focus handling or dialog semantics.
Projects become cleaner when rendering is explicit.
function render() {
output.textContent = String(state.value);
}
Tell users what happened after an action.
status.setAttribute("role", "status");
status.textContent = "Saved successfully.";
Rules that matter
A good practice project has state, interaction, feedback and a clear next improvement.
The project should have meaning before JavaScript.
Use arrays, objects or variables that describe the feature.
Rendering should be repeatable after state changes.
Small projects still need real product thinking.
Use buttons, labels, status messages and focus deliberately.
First make it work, then make it clean.
Production thinking
Projects make knowledge stick. They force separate topics to work together in the same page.
Every project should include semantic controls, labels and status feedback so the feature is usable beyond the happy path.
Production projects need file structure, tests, error handling and a clear release checklist once the prototype works.
Project pages are useful learning content when the code, explanation and outcome are all visible.
Live code lab
The preview runs inside an isolated iframe. The JavaScript is placed inside the HTML editor for now, so every example stays together and remains easy to understand.
Mini assignment
Practice assignment
Try it yourself
Self-check
Answer these before moving to the next project lesson.
Senior audit upgrade