Time to practise! Let’s write your very first JavaScript program together.

Displaying a message

Open the console (F12) and type:

console.log("Bonjour le monde !");

Press Enter: the message appears. Congratulations, you have just run some JavaScript!

A few ground rules

  • Every statement ends with a semicolon ;.
  • Text goes between quotation marks (single or double).
  • JavaScript is case-sensitive: Console and console are two different things.

Now try alert("Hi!");: a small window pops up on the page. You are already seeing interactivity at work.

Key takeaway: a script is a sequence of statements. Start small, test often in the console, and build up step by step.