Skip to content

Commit 22426a2

Browse files
author
Márcio Rodrigo
committed
Update declare-variables and uppercast-constant
1 parent 4ce5a2c commit 22426a2

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
First, the variable for the name of our planet.
1+
Primeiro, a variável para o nome do nosso planeta.
22

3-
That's simple:
3+
Isso é simples:
44

55
```js
66
let ourPlanetName = "Earth";
77
```
88

9-
Note, we could use a shorter name `planet`, but it might be not obvious what planet it refers to. It's nice to be more verbose. At least until the variable isNotTooLong.
9+
Note que poderíamos usar um nome mais curto, `planet`, mas pode não ser óbvio a que planeta se refere. É bom ser mais detalhado. Pelo menos até a variável isNotTooLong.
1010

11-
Second, the name of the current visitor:
11+
Em segundo lugar, o nome do visitante atual:
1212

1313
```js
1414
let currentUserName = "John";
1515
```
1616

17-
Again, we could shorten that to `userName` if we know for sure that the user is current.
17+
Novamente, nós poderíamos encurtar isso para `userName` se tivermos certeza que o usuário é atual.
1818

19-
Modern editors and autocomplete make long variable names easy to write. Don't save on them. A name with 3 words in it is fine.
19+
Os editores modernos e o autocomplete facilitam a escrita de nomes longos de variáveis. Não salve neles. Um nome com 3 palavras é o suficiente.
2020

21-
And if your editor does not have proper autocompletion, get [a new one](/code-editors).
21+
E se o seu editor não possui autocompletar corretamente, obtenha [um novo](/code-editors).
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
importance: 3
1+
importância: 3
22

33
---
44

5-
# Giving the right name
5+
# Dando o nome certo
66

7-
1. Create a variable with the name of our planet. How would you name such a variable?
8-
2. Create a variable to store the name of a current visitor to a website. How would you name that variable?
7+
1. Criar uma variável com o nome do nosso planeta. Como você nomearia tal variável?
8+
2. Crie uma variável para armazenar o nome de um visitante atual em um site. Como você nomearia essa variável?
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
We generally use upper case for constants that are "hard-coded". Or, in other words, when the value is known prior to execution and directly written into the code.
1+
Nós geralmente usamos letras maiúsculas para constantes que são "hard-coded". Ou, em outras palavras, quando o valor é conhecido antes da execução e diretamente escrito no código.
22

3-
In this code, `birthday` is exactly like that. So we could use the upper case for it.
3+
Neste código, o `birthday` é exatamente assim. Então nós poderíamos usar a maiúscula para ele.
44

5-
In contrast, `age` is evaluated in run-time. Today we have one age, a year after we'll have another one. It is constant in a sense that it does not change through the code execution. But it is a bit "less of a constant" than `birthday`, it is calculated, so we should keep the lower case for it.
5+
Em contraste, `age` é avaliada em tempo de execução. Hoje temos uma idade, um ano depois teremos outra. É constante no sentido de não mudar através da execução do código. Mas é um pouco "menos constante" do que `birthday`, é calculada, por isso devemos manter as minúsculas para ela.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
importance: 4
1+
importância: 4
22

33
---
44

5-
# Uppercase const?
5+
# Const maiúsculo?
66

7-
Examine the following code:
7+
Examine o seguinte código:
88

99
```js
1010
const birthday = '18.04.1982';
1111

1212
const age = someCode(birthday);
1313
```
1414

15-
Here we have a constant `birthday` date and the `age` is calculated from `birthday` with the help of some code (it is not provided for shortness, and because details don't matter here).
15+
Aqui temos uma constante `birthday` e a `age` que é calculada apartir de `birthday` com a ajuda de algum código (não é fornecido por falta de tempo, e porque os detalhes não importam aqui).
1616

17-
Would it be right to use upper case for `birthday`? For `age`? Or even for both?
17+
Seria correcto utilizar maiúsculas para `birthday`? Para `age`? Ou mesmo para ambos?
1818

1919
```js
20-
const BIRTHDAY = '18.04.1982'; // make uppercase?
20+
const BIRTHDAY = '18.04.1982'; // fazer maiúsculas?
2121

22-
const AGE = someCode(BIRTHDAY); // make uppercase?
22+
const AGE = someCode(BIRTHDAY); // fazer maiúsculas?
2323
```
2424

0 commit comments

Comments
 (0)