← Winnitude! Search  ·  Reader Mode (1381 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 50 LINKS

The old "var" by diogoosz · Pull Request #477 · javascript-tutorial/pt.javascript.info

Repository navigation

The old "var" - #477


Merged
gabifs merged 2 commits into javascript-tutorial:master from diogoosz:translate-old-var Nov 21, 2026
Merged

The old "var" #477 gabifs merged 2 commits into javascript-tutorial:master from diogoosz:translate-old-var

Conversation

diogoosz commented Nov 8, 2026



Copy link Copy Markdown
Contributor

Tradução do artigo "The old var" para o português.

Conforme comentado na #1 .

Translate "The old var" article to Portuguese ca40268
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/04-var/article.md
Outdated

*!*
alert(test); // ReferenceError: test is not defined
alert(test); // ReferenceError: test não está definido
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/04-var/article.md
Outdated

sayHi();
alert(phrase); // ReferenceError: phrase is not defined
alert(phrase); // ReferenceError: phrase não está definido
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/04-var/article.md
Outdated

*!*+*/!*function() {
alert(" Unary plus starts the expression ");
alert(" Operador unário de adição inicia a expressão ");
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/04-var/article.md
Outdated
```

As we can see , `var` pierces through `if`, `for` or other code blocks. That's because a long time ago in JavaScript , blocks had no Lexical Environments, and `var` is a remnant of that .
Como podemos ver , `var` atravessa o `if`, o `for` ou outros blocos de código. Isso acontece porque, há muito tempo, no JavaScript os blocos não tinham Ambientes Léxicos, e `var` é um resquício disso .
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/04-var/article.md
Outdated
Então, os parênteses em torno da função são um truque para mostrar ao JavaScript que a função é criada no contexto de outra expressão, e, portanto, é uma Expressão de Função: ela não precisa de nome e pode ser chamada imediatamente .

There exist other ways besides parentheses to tell JavaScript that we mean a Function Expression :
Existem outras formas, além dos parênteses, de dizer ao JavaScript que queremos dizer uma Expressão de Função :
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/04-var/article.md
Outdated

1. `var` variables have no block scope, their visibility is scoped to current function, or global, if declared outside function .
2. `var` declarations are processed at function start ( script start for globals ).
1. As variáveis `var` não têm escopo de bloco, sua visibilidade tem escopo na função atual, ou global, se declaradas fora de uma função .
gabifs mentioned this pull request Nov 12, 2026 Portuguese Translation Progress #1 Open Apply review feedback from @gabifs 7d2fe80
- Fix error messages that don't match what the engine actually
  prints: translated "ReferenceError" text -> the real English
  message, consistent with the untranslated SyntaxError messages
  elsewhere in the same file and the rest of the repo
- "Operador unário de adição" (wrong meaning, suggests addition) ->
  "Operador mais unário" (the unary + operator), matching the term
  used in 99-js-misc/05-bigint
- "Ambientes Léxicos" -> "Lexical Environments" (kept in English
  throughout the tutorial, including in the closure chapter this
  text links back to)
- Fix repeated verb: "dizer ao JavaScript que queremos dizer" ->
  "indicar ao JavaScript que se trata de"
- Reword awkward "sua visibilidade tem escopo na função atual"

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

diogoosz commented Nov 21, 2026



Copy link Copy Markdown
Contributor

Author

Obrigado, @gabifs ! Apliquei tudo: corrigi as mensagens de erro traduzidas que não batem com o que o motor realmente exibe, "Operador unário de adição"→"Operador mais unário" (consistente com 99-js-misc/05-bigint), "Ambientes Léxicos"→"Lexical Environments" (mantido em inglês em todo o tutorial), corrigi o verbo repetido em "dizer...que queremos dizer", e reescrevi a frase estranha sobre escopo de var.

gabifs merged commit 6dd8437 into javascript-tutorial : master Nov 21, 2026 1 check passed Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

2 participants