JavaScript - interactive pages (INF.03)

Bring your page to life - DOM, events and form validation

A JavaScript course within the INF.03 scope: language basics, DOM manipulation, event handling and client-side form validation. The exercises bring the pages from the HTML and CSS courses to life.

Course modules

M1 Introduction to JavaScript 4 lessons
  1. What is JavaScript

    History, its role on the internet, JavaScript vs HTML vs CSS. How it works in the browser.

    10 min · 15 XP · 0/3 exercises
  2. Adding JS to HTML

    The <script> tag, the src attribute, defer vs async, good practices for placing scripts.

    10 min · 15 XP · 0/2 exercises
  3. JS syntax: statements, comments

    Semicolons, case sensitivity, single-line and block comments, white space.

    10 min · 15 XP · 0/2 exercises
  4. console.log and debugging

    The browser console, console.log / warn / error, debugger, working with DevTools.

    10 min · 15 XP · 0/2 exercises
M2 Variables, types, operators 4 lessons
  1. Variables: let, const, var

    Declaring variables, the differences between let, const and var, hoisting, good practices.

    12 min · 15 XP · 0/2 exercises
  2. Data types in JavaScript

    string, number, boolean, null, undefined, bigint, symbol. The typeof operator.

    12 min · 15 XP · 0/2 exercises
  3. Operators and comparisons (== vs ===)

    Arithmetic, logical and assignment operators. The difference between == and ===. Falsy values.

    12 min · 15 XP · 0/2 exercises
  4. Type conversions and template strings

    parseInt, parseFloat, Number(), String(), Boolean(). Template literals - backticks and interpolation.

    12 min · 15 XP · 0/2 exercises
M3 Control structures 4 lessons
  1. if, else, else if, the ternary operator

    Conditional statements, nesting, the ternary operator. Readable decision-making code.

    12 min · 15 XP · 0/2 exercises
  2. switch-case

    The switch statement, case, default, break. When to use switch instead of if-else.

    10 min · 15 XP · 0/2 exercises
  3. Loops: for, while, do-while

    The classic for loop, while with a condition, do-while. Counters, iteration, the risk of an infinite loop.

    15 min · 20 XP · 0/2 exercises
  4. for...of, for...in, break, continue

    Iterating over arrays (for...of) and objects (for...in). Interrupting loops: break, continue.

    12 min · 20 XP · 0/2 exercises
M4 Functions 4 lessons
  1. Function declaration, parameters, return

    Creating functions with the function keyword, parameters with default values, the return statement.

    15 min · 20 XP · 0/2 exercises
  2. Function expressions and arrow functions

    Functions as values, function expressions, the arrow function (=>), shorthand syntax.

    15 min · 20 XP · 0/2 exercises
  3. Variable scope and closures

    Global and local scope, block scope (let/const), closures. Typical traps.

    15 min · 20 XP · 0/2 exercises
  4. Callbacks - an introduction

    A function as an argument, setTimeout, setInterval. Callbacks in events and array methods.

    15 min · 20 XP · 0/2 exercises
M5 Arrays and objects 4 lessons
  1. Arrays: creating, indexes, push/pop methods

    Creating arrays, access by index, length, push, pop, shift, unshift, splice.

    15 min · 20 XP · 0/2 exercises
  2. forEach, map, filter, find, sort

    Iterating and transforming arrays. forEach, map, filter, find, findIndex, sort, includes.

    15 min · 20 XP · 0/2 exercises
  3. Objects: properties, methods, iteration

    The object literal, access with . and [], adding/removing properties, methods, for...in.

    15 min · 20 XP · 0/2 exercises
  4. JSON: stringify, parse

    The JSON format, JSON.stringify(), JSON.parse(), working with data from an API and localStorage.

    12 min · 20 XP · 0/2 exercises
M6 DOM: selecting and changing elements 6 lessons
  1. What is the DOM - the document tree

    The Document Object Model: a tree of nodes, the browser builds the DOM from HTML, inspecting in DevTools.

    10 min · 20 XP · 0/2 exercises
  2. querySelector, getElementById, querySelectorAll

    Methods of selecting elements: getElementById, querySelector, querySelectorAll, HTMLCollection vs NodeList.

    15 min · 20 XP · 0/2 exercises
  3. textContent, innerHTML (and XSS)

    Changing text with textContent. innerHTML and the risk of XSS - when to use it with care.

    15 min · 20 XP · 0/2 exercises
  4. setAttribute, getAttribute, value, src

    Reading and writing attributes. value for form fields, src for images, href for links.

    15 min · 20 XP · 0/2 exercises
  5. classList (add/remove/toggle), style

    classList.add, remove, toggle, contains. Inline style through element.style. Classes vs inline CSS.

    15 min · 20 XP · 0/2 exercises
  6. createElement, appendChild, remove

    Creating nodes dynamically: createElement, textContent, appendChild, insertBefore, remove.

    15 min · 25 XP · 0/2 exercises
M7 Events 4 lessons
  1. The event model, addEventListener

    What an event is. addEventListener(type, handler), removeEventListener. Event bubbling.

    15 min · 25 XP · 0/2 exercises
  2. click, dblclick, mouseover, mouseout

    Mouse events: click, dblclick, mouseenter, mouseleave, mouseover, mouseout. Practical examples.

    12 min · 20 XP · 0/2 exercises
  3. keydown, keyup; submit, change, input, focus, blur

    Keyboard and form events. keydown, keyup, change, input, focus, blur, submit.

    15 min · 20 XP · 0/2 exercises
  4. event.target, preventDefault, stopPropagation

    The event object: target, currentTarget, type. Blocking the default action, stopping bubbling.

    15 min · 25 XP · 0/2 exercises
M8 Form validation 5 lessons
  1. Why client-side validation vs server-side

    Form UX, the difference between client and server validation, why both are necessary.

    10 min · 20 XP · 0/2 exercises
  2. Reading field values: value, checked, empty fields

    Getting the values of inputs, textarea, select. checkbox.checked. Checking for empty fields.

    15 min · 20 XP · 0/2 exercises
  3. Validation: numbers, email, length, RegExp

    isNaN, Number(), test() with regular expressions. Validating email, phone number, password length.

    20 min · 25 XP · 0/2 exercises
  4. Showing errors next to fields, blocking submit

    Inserting error messages into the DOM, error styles, event.preventDefault() on errors.

    20 min · 25 XP · 0/2 exercises
  5. Complete form validation

    A complex form with many fields - the full flow: validation, errors, blocking and confirmation.

    25 min · 30 XP · 0/2 exercises
M9 Exam revision 2 lessons
  1. The most common JS traps from CKE exam sheets

    Typical exam mistakes: == vs ===, hoisting, undefined vs null, syntax errors, event order.

    15 min · 20 XP · 0/2 exercises
  2. Mini-sheets: bring the page to life per the task

    A simulation of an INF.03 exam task: bringing a ready-made HTML/CSS page to life with JS code.

    30 min · 50 XP · 0/2 exercises