GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Variable scope, closure by diogoosz · Pull Request #486 · javascript-tutorial/pt.javascript.info

Conversation

@diogoosz

@diogoosz diogoosz commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Tradução do artigo "Variable scope, closure" para o português, incluindo os 10 exercícios e as 13 imagens traduzidas (closure-function-declaration.svg, closure-variable-phrase.svg, lexical-environment-global.svg, lexical-environment-global-2.svg, lexical-environment-global-3.svg, lexical-environment-simple.svg, closure-makecounter.svg, closure-makecounter-nested-call-2.svg, lexenv-nested-makecounter-2.svg, lexenv-nested-makecounter-6.svg, lexenv-makearmy-empty.svg, lexenv-makearmy-for-fixed.svg, lexenv-makearmy-while-fixed.svg).

Conforme comentado na #1.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diogoosz @claude
Translate "Variable scope, closure" article to Portuguese
496af68
Co-Authored-By: Claude Sonnet 5 <[email protected]>
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/2-closure-variable-access/task.md

// call it
work(); // what will it show?
// a chama

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// a chama (for "call it") reads as "the flame" in Portuguese — ambiguous comment. Suggest // chama a função or // chamando-a.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/article.md
A explicação técnica aprofundada vem a seguir.

As far as I'd like to avoid low-level language details, any understanding without them would be lacking and incomplete, so get ready.
Por mais que eu gostaria de evitar detalhes de baixo nível da linguagem, qualquer entendimento sem eles ficaria incompleto e deficiente, então se prepare.

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar: "Por mais que" requires the subjunctive — "Por mais que eu gostasse de evitar..." (not "gostaria").

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/article.md
Como você pôde ver -- não existe essa variável! Em teoria, ela deveria ser acessível, mas o motor a otimizou e removeu.

That may lead to funny (if not such time-consuming) debugging issues. One of them -- we can see a same-named outer variable instead of the expected one:
Isso pode levar a problemas de depuração engraçados (se não tão demorados). Um deles -- podemos ver uma variável externa de mesmo nome em vez da esperada:

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaning lost: original "funny (if not such time-consuming)" = "would be funny if they weren't so time-consuming". "(se não tão demorados)" reads as "if not so slow". Suggest: "problemas de depuração engraçados (se não fossem tão demorados)".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/6-closure-sum/solution.md
@@ -1,12 +1,12 @@
For the second parentheses to work, the first ones must return a function.
Para o segundo parênteses funcionar, o primeiro precisa retornar uma função.

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Number agreement: "parênteses" is plural. Suggest "Para os segundos parênteses funcionarem, os primeiros precisam retornar uma função." (or "o segundo par de parênteses ... o primeiro").

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread images.yml
text: "Ambiente Léxico"
position: left
"of makeCounter() call":
text: "da chamada de makeCounter()"

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"da chamada de makeCounter()" (27 chars) is ~6 chars longer than "of makeCounter() call" (21) and is left-anchored at x=275 in closure-makecounter.svg / lexenv-nested-makecounter-2.svg (PT Mono 12px ≈ 7.2px/char → ends ≈ x=469, past where the right-aligned "Ambiente Léxico global" starts at x=461). Please render to check it does not collide with the diagram/arrows; a shorter label like "de makeCounter()" would avoid it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/article.md
Existe um termo geral de programação, "closure", que os desenvolvedores geralmente deveriam conhecer.

A [closure](https://en.wikipedia.org/wiki/Closure_(computer_programming)) is a function that remembers its outer variables and can access them. In some languages, that's not possible, or a function should be written in a special way to make it happen. But as explained above, in JavaScript, all functions are naturally closures (there is only one exception, to be covered in <info:new-function>).
Uma [closure](https://en.wikipedia.org/wiki/Closure_(computer_programming)) é uma função que lembra suas variáveis externas e consegue acessá-las. Em algumas linguagens, isso não é possível, ou uma função precisa ser escrita de uma forma especial pra isso acontecer. Mas, como explicado acima, no JavaScript, todas as funções são naturalmente closures (existe só uma exceção, que será coberta em <info:new-function>).

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent: line 145 switched the PRNG link to pt.wikipedia, but this closure link stays on en.wikipedia. pt.wikipedia has the article: https://pt.wikipedia.org/wiki/Clausura_(ci%C3%AAncia_da_computa%C3%A7%C3%A3o)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/article.md
Então, `counter.[[Environment]]` tem a referência ao Ambiente Léxico `{count: 0}`. É assim que a função lembra onde foi criada, não importa onde seja chamada. A referência `[[Environment]]` é definida uma vez e para sempre no momento da criação da função.

Later, when `counter()` is called, a new Lexical Environment is created for the call, and its outer Lexical Environment reference is taken from `counter.[[Environment]]`:
Mais tarde, quando `counter()` é chamada, um novo Ambiente Léxico é criado para a chamada, e sua referência de Ambiente Léxico externo é pega de `counter.[[Environment]]`:

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"é pega de" is colloquial participle; for technical prose prefer "é obtida de counter.[[Environment]]".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/8-filter-through-function/task.md
---

# Filter through function
# Filtra através de uma função

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title verb form inconsistent with sibling task titles (e.g. "Ordenar por campo"). Suggest "Filtrar através de uma função".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gabifs
gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/03-closure/article.md
Para clareza, a explicação é dividida em várias etapas.

### Step 1. Variables
### Passo 1. Variáveis

@gabifs gabifs Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terminology mismatch: line 159 says "várias etapas" but headings use "Passo 1/2/3/4". Pick one (e.g. "Etapa 1. Variáveis" or "dividida em vários passos").

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gabifs gabifs mentioned this pull request Nov 12, 2026
Portuguese Translation Progress #1
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gabifs gabifs gabifs left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@diogoosz @gabifs
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.