console.log and comments
Esta página necesita un navegador reciente (con soporte para SharedArrayBuffer). Por favor, actualiza Chrome, Edge, Firefox o Safari a la última versión.
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.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Utilice console.log(...) to print the word Hello.
Haz clic en Ejecutar para ver la salida aquí.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Print Red, Green y Blue, one per line, in that order.
Haz clic en Ejecutar para ver la salida aquí.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Print the result of 5 + 3 (it is 8).
Haz clic en Ejecutar para ver la salida aquí.