Skip to content

Commit f3fb7d2

Browse files
committed
translate '01-object' directory files
1 parent 7b578db commit f3fb7d2

File tree

14 files changed

+281
-289
lines changed

14 files changed

+281
-289
lines changed
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11

2-
32
```js
43
let user = {};
54
user.name = "John";
65
user.surname = "Smith";
76
user.name = "Pete";
87
delete user.name;
98
```
10-

1-js/04-object-basics/01-object/2-hello-object/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ importance: 5
22

33
---
44

5-
# Hello, object
5+
# Olá, objeto
66

7-
Write the code, one line for each action:
7+
Escreva o código, uma ação por linha:
88

9-
1. Create an empty object `user`.
10-
2. Add the property `name` with the value `John`.
11-
3. Add the property `surname` with the value `Smith`.
12-
4. Change the value of the `name` to `Pete`.
13-
5. Remove the property `name` from the object.
9+
1. Crie um objeto vazio (*empty object*) `user`.
10+
2. Adicione a propriedade `name` com o valor `John`.
11+
3. Adicione a propriedade `surname` com o valor `Smith`.
12+
4. Altere o valor de `name` para `Pete`.
13+
5. Remova a propriedade `name` do objeto.
1414

1-js/04-object-basics/01-object/3-is-empty/_js.view/solution.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function isEmpty(obj) {
22
for (let key in obj) {
3-
// if the loop has started, there is a property
3+
// se o laço começou, existe uma propriedade
44
return false;
55
}
66
return true;

1-js/04-object-basics/01-object/3-is-empty/_js.view/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
describe("isEmpty", function() {
2-
it("returns true for an empty object", function() {
2+
it("retorna verdadeiro para um objeto vazio", function() {
33
assert.isTrue(isEmpty({}));
44
});
55

6-
it("returns false if a property exists", function() {
6+
it("retorna falso se uma propriedade existir", function() {
77
assert.isFalse(isEmpty({
88
anything: false
99
}));
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Just loop over the object and `return false` immediately if there's at least one property.
1+
Simplemente, percorra (*loop over*) o objeto e imediatamente `return false` se pelo menos houver uma propriedade.

1-js/04-object-basics/01-object/3-is-empty/task.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ importance: 5
22

33
---
44

5-
# Check for emptiness
5+
# Verifique por vazio (*emptiness*)
66

7-
Write the function `isEmpty(obj)` which returns `true` if the object has no properties, `false` otherwise.
8-
9-
Should work like that:
7+
Escreva a função `isEmpty(obj)`, que retorna `true` se o objeto não tiver propriedades, e `false` caso contrário.
108

9+
Deve assim funcionar:
1110
```js
1211
let schedule = {};
1312

14-
alert( isEmpty(schedule) ); // true
13+
alert( isEmpty(schedule) ); // verdadeiro
1514

16-
schedule["8:30"] = "get up";
15+
schedule["8:30"] = "levante-se";
1716

18-
alert( isEmpty(schedule) ); // false
17+
alert( isEmpty(schedule) ); // falso
1918
```
2019

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
Sure, it works, no problem.
1+
Com certeza, funciona, sem problemas.
22

3-
The `const` only protects the variable itself from changing.
3+
A `const` apenas protege a própria variável contra alterações.
44

5-
In other words, `user` stores a reference to the object. And it can't be changed. But the content of the object can.
5+
Por outras palavras, `user` armazena uma referência ao objeto. E não pode ser alterada. Mas, o conteúdo do objeto pode.
66

77
```js run
88
const user = {
99
name: "John"
1010
};
1111

1212
*!*
13-
// works
13+
// funciona
1414
user.name = "Pete";
1515
*/!*
1616

17-
// error
17+
// erro
1818
user = 123;
1919
```

1-js/04-object-basics/01-object/4-const-object/task.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ importance: 5
22

33
---
44

5-
# Constant objects?
5+
# Objetos constantes?
66

7-
Is it possible to change an object declared with `const`? What do you think?
7+
É possível alterar um objeto declarado com `const`? O que acha?
88

99
```js
1010
const user = {
1111
name: "John"
1212
};
1313

1414
*!*
15-
// does it work?
15+
// isto funciona?
1616
user.name = "Pete";
1717
*/!*
1818
```

1-js/04-object-basics/01-object/5-sum-object/task.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 5
22

33
---
44

5-
# Sum object properties
5+
# Soma das propriedades de um objeto
66

7-
We have an object storing salaries of our team:
7+
Temos um objeto armazenando salários da nossa equipa:
88

99
```js
1010
let salaries = {
@@ -14,6 +14,6 @@ let salaries = {
1414
}
1515
```
1616

17-
Write the code to sum all salaries and store in the variable `sum`. Should be `390` in the example above.
17+
Escreva o código para somar todos os salários e armazenar na variável `sum`. Para o exemplo acima, deverá ser `390`.
1818

19-
If `salaries` is empty, then the result must be `0`.
19+
Se `salaries` for vazio, então o resultado deve ser `0`.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
let menu = {
22
width: 200,
33
height: 300,
4-
title: "My menu"
4+
title: "O meu menu"
55
};
66

77

88
function multiplyNumeric(obj) {
99

10-
/* your code */
10+
/* o seu código */
1111

1212
}
1313

1414
multiplyNumeric(menu);
1515

16-
alert( "menu width=" + menu.width + " height=" + menu.height + " title=" + menu.title );
16+
alert( "largura do menu=" + menu.width + " altura=" + menu.height + " título=" + menu.title );
1717

0 commit comments

Comments
 (0)