console.log and comments
Cette page nécessite un navigateur récent (avec support SharedArrayBuffer). Veuillez mettre à jour Chrome, Edge, Firefox ou Safari vers la dernière version.
English
The language of the web
- JavaScript runs inside every web browser. It makes pages do things — buttons, games, maps, chat.
console.log(...)prints a message to the console, a window for text output.- Anything after
//is a comment. JavaScript ignores it — it is a note for humans reading the code.

English
console.log("Hello, world!"); // → Hello, world!
// this whole line is a comment — it does nothing
English
Print text, numbers, or both
- Text goes inside quotes:
"hello". Numbers do not:42. - Pass several items separated by commas — they print on one line, with a space between.
English
console.log("Score:", 42); // → Score: 42
console.log(3 + 4); // → 7
English
Watch out
- Text needs quotes.
console.log(Hello)is an error — JavaScript hunts for something namedHello. - End each statement with a semicolon
;. It is a good habit, even where JavaScript would forgive you.
English
Common mistakes
console.log(...)prints; text needs quotes.//starts a comment.
English
Now you try
- Use
console.log(...)to print. - Press Run to see the output, then Check answer.
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Utiliser console.log(...) to print the word Hello.
Cliquez sur Exécuter pour voir le résultat ici.
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Print Red, Green et Blue, one per line, in that order.
Cliquez sur Exécuter pour voir le résultat ici.
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Print the result of 5 + 3 (it is 8).
Cliquez sur Exécuter pour voir le résultat ici.