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

To handle several pieces of data at once, JavaScript offers two essential structures: arrays and objects.

Arrays

An array stores several values in an ordered list:

const fruits = ["pomme", "banane", "cerise"];
console.log(fruits[0]); // "pomme"

You reach each item through its index, which starts at 0. You can go through an array with a loop or with the forEach method.

Objects

An object groups related information as key: value pairs:

const personne = {
  prenom: "Marie",
  age: 25
};
console.log(personne.prenom); // "Marie"
  • An array is perfect for a list of similar items.
  • An object describes a single entity through its properties.

Key takeaway: an array orders a list (index starting at 0), an object describes one thing through its properties (key: value).

Prix indicatifs, convertis depuis l'euro