console.log and comments
Esta página precisa de um navegador recente (com suporte a SharedArrayBuffer). Por favor, atualize Chrome, Edge, Firefox ou Safari para a versão mais recente.
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.
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Use console.log(...) to print the word Hello.
Clique em Executar para ver a saída aqui.
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Print Red, Green e Blue, one per line, in that order.
Clique em Executar para ver a saída aqui.
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Print the result of 5 + 3 (it is 8).
Clique em Executar para ver a saída aqui.