console.log and comments · console.log e comentários
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 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.
Português
A linguagem da web
- JavaScript roda dentro de todo navegador web. Ele faz páginas fazerem coisas — botões, jogos, mapas, bate-papo.
console.log(...)imprime uma mensagem no console, uma janela para saída de texto.- Tudo após
//é um comentário. JavaScript o ignora — é uma anotação para humanos lendo o código.
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.
Português
Imprima texto, números ou ambos
- Texto vai dentro de aspas:
"hello". Números não:42. - Passe vários itens separados por vírgulas — eles são impressos em uma linha, com um espaço entre eles.
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.
Português
Atenção
- Texto precisa de aspas.
console.log(Hello)é um erro — JavaScript procura algo chamadoHello. - Termine cada instrução com ponto e vírgula
;. É um bom hábito, mesmo onde JavaScript perdoaria.
English
Common mistakes
console.log(...)prints; text needs quotes.//starts a comment.
Português
Erros comuns
console.log(...)imprime; texto precisa de aspas.//inicia um comentário.
English
Now you try
- Use
console.log(...)to print. - Press Run to see the output, then Check answer.
Português
Agora você tenta
- Use
console.log(...)para imprimir. - Pressione Run para ver a saída, depois Check answer.
Use console.log(...) to print the word Hello. · Use console.log(...) para imprimir a palavra Hello.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.
Print Red, Green and · e Blue, one per line, in that order. · Imprima Red, Green e Blue, um por linha, nessa ordem.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.
Print the result of 5 + 3 (it is 8). · Imprima o resultado de 5 + 3 (é 8).
Click Run to see the output here. · Clique em Executar para ver a saída aqui.