Skip to content

Commit aae89e8

Browse files
author
Márcio Rodrigo
committed
Update 04-variables/article.md
1 parent 22426a2 commit aae89e8

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

1-js/02-first-steps/04-variables/article.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,96 @@
1-
# Variables
1+
# Variáveis
22

3-
Most of the time, a JavaScript application needs to work with information. Here are two examples:
4-
1. An online shop -- the information might include goods being sold and a shopping cart.
5-
2. A chat application -- the information might include users, messages, and much more.
3+
Na maioria das vezes, um aplicativo JavaScript precisa trabalhar com informações. Aqui estão dois exemplos:
4+
1. Uma loja online -- a informação pode incluir mercadorias vendidas e um carrinho de compras.
5+
2. Uma aplicação de chat -- a informação pode incluir usuários, mensagens e muito mais.
66

7-
Variables are used to store this information.
7+
Variáveis são usadas para armazenar esta informação.
88

9-
## A variable
9+
## Uma variável
1010

11-
A [variable](https://en.wikipedia.org/wiki/Variable_(computer_science)) is a "named storage" for data. We can use variables to store goodies, visitors, and other data.
11+
Uma [variável](https://pt.wikipedia.org/wiki/Variável_(programação)) é um "armazenamento nomeado" para dados. Podemos usar variáveis para armazenar artigos, visitantes e outros dados.
1212

13-
To create a variable in JavaScript, use the `let` keyword.
13+
Para criar uma variável em JavaScript, use a palavra-chave `let`.
1414

15-
The statement below creates (in other words: *declares* or *defines*) a variable with the name "message":
15+
A declaração abaixo cria (em outras palavras: * declara * ou * define *) uma variável com o nome "message":
1616

1717
```js
1818
let message;
1919
```
2020

21-
Now, we can put some data into it by using the assignment operator `=`:
21+
Agora, podemos colocar alguns dados usando o operador de atribuição `=`:
2222

2323
```js
2424
let message;
2525

2626
*!*
27-
message = 'Hello'; // store the string
27+
message = 'Olá'; // armazenar a string
2828
*/!*
2929
```
3030

31-
The string is now saved into the memory area associated with the variable. We can access it using the variable name:
31+
A string agora é armazenada na área de memória associada à variável. Nós podemos acessá-la usando o nome da variável:
3232

3333
```js run
3434
let message;
35-
message = 'Hello!';
35+
message = 'Olá!';
3636

3737
*!*
38-
alert(message); // shows the variable content
38+
alert(message); // mostra o conteúdo variável
3939
*/!*
4040
```
4141

42-
To be concise, we can combine the variable declaration and assignment into a single line:
42+
Para ser conciso, podemos combinar a declaração de variável e atribuição em uma única linha:
4343

4444
```js run
45-
let message = 'Hello!'; // define the variable and assign the value
45+
let message = 'Olá!'; // define a variável e atribui o valor
4646

47-
alert(message); // Hello!
47+
alert(message); // Olá!
4848
```
4949

50-
We can also declare multiple variables in one line:
50+
Podemos também declarar múltiplas variáveis em uma linha:
5151

5252
```js no-beautify
53-
let user = 'John', age = 25, message = 'Hello';
53+
let user = 'John', age = 25, message = 'Olá';
5454
```
5555

56-
That might seem shorter, but we don't recommend it. For the sake of better readability, please use a single line per variable.
56+
Isso pode parecer mais curto, mas não o recomendamos. Por uma questão de melhor legibilidade, use uma única linha por variável.
5757

58-
The multiline variant is a bit longer, but easier to read:
58+
A variante multilinha é um pouco mais longa, mas mais fácil de ler:
5959

6060
```js
6161
let user = 'John';
6262
let age = 25;
63-
let message = 'Hello';
63+
let message = 'Olá';
6464
```
6565

66-
Some people also define multiple variables in this multiline style:
66+
Algumas pessoas também definem múltiplas variáveis nesse estilo multilinha:
6767
```js no-beautify
6868
let user = 'John',
6969
age = 25,
70-
message = 'Hello';
70+
message = 'Olá';
7171
```
7272

73-
...Or even in the "comma-first" style:
73+
... Ou até mesmo no estilo "comma-first":
7474

7575
```js no-beautify
7676
let user = 'John'
7777
, age = 25
78-
, message = 'Hello';
78+
, message = 'Olá';
7979
```
8080

81-
Technically, all these variants do the same thing. So, it's a matter of personal taste and aesthetics.
81+
Tecnicamente, todas estas variantes fazem a mesma coisa. Então, é uma questão de gosto pessoal e estética.
8282

8383

8484
````smart header="`var` instead of `let`"
85-
In older scripts, you may also find another keyword: `var` instead of `let`:
85+
Em scripts antigos, você também pode encontrar outra palavra-chave: `var` em vez de `let`:
8686

8787
```js
88-
*!*var*/!* message = 'Hello';
88+
*!*var*/!* message = 'Olá';
8989
```
9090

91-
The `var` keyword is *almost* the same as `let`. It also declares a variable, but in a slightly different, "old-school" way.
91+
A palavra-chave `var` é quase a mesma que `let`. Ela também declara uma variável, mas de um modo um pouco diferente, "old-school".
9292

93-
There are subtle differences between `let` and `var`, but they do not matter for us yet. We'll cover them in detail in the chapter <info:var>.
93+
Existem diferenças sutis entre `let` e `var`, mas elas ainda não são importantes para nós. Nós as abordaremos em detalhes no capítulo <info:var>.
9494
````
9595
9696
## A real-life analogy

0 commit comments

Comments
 (0)