Contenu du cours
Module 1 — Discovering JavaScript
What JavaScript does, where to write your code, the console and a first script.
0/4
Module 2 — Language fundamentals
Variables and types, operators and conditions, then loops.
0/4
Module 3 — Functions and interactivity
Writing functions, responding to events and manipulating the DOM.
0/4
Module 4 — Going further
Arrays and objects, an introduction to APIs with fetch, and best practice.
0/4
JavaScript for beginners

The DOM (Document Object Model) is your HTML page represented as objects that JavaScript can read and modify. That is how you change a page on the fly.

Selecting an element

  • document.querySelector("h1") — the first matching element.
  • document.getElementById("titre") — an element by its id.

Modifying an element

const titre = document.querySelector("h1");
titre.textContent = "Nouveau titre !";
titre.style.color = "blue";

This lets you:

  • Change the text with textContent.
  • Change the styling with style.
  • Add or remove classes with classList.

By combining selection, events and DOM changes, you make a page genuinely dynamic: a click can display a message, change a colour or reveal hidden content.

Key takeaway: select an element, then change its text or its style. The DOM is the bridge between your code and the page on screen.

Prix indicatifs, convertis depuis l'euro