Skip to content

Commit e623e5a

Browse files
committed
Merge branch 'javascript-tutorial:master' into update-symbol
1 parent d73cab0 commit e623e5a

File tree

33 files changed

+185
-392
lines changed

33 files changed

+185
-392
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
importância: 5
1+
importance: 5
22

33
---
44

55
# Mostrar um alerta com um script externo
66

77
Tome a solução da tarefa anterior <info:task/hello-alert>. Modifique-o extraindo o conteúdo do script para um arquivo externo `alert.js`, residindo na mesma pasta.
88

9-
Abra a página, verifique se o alerta funciona.
9+
Abra a página, verifique se o alerta funciona.

1-js/02-first-steps/04-variables/1-hello-variables/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
importância: 2
1+
importance: 2
22

33
---
44

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
importância: 3
1+
importance: 3
22

33
---
44

55
# Dando o nome certo
66

77
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?
8+
2. Crie uma variável para armazenar o nome de um visitante atual em um site. Como você nomearia essa variável?

1-js/02-first-steps/04-variables/3-uppercast-constant/task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
importância: 4
1+
importance: 4
22

33
---
44

1-js/02-first-steps/05-types/1-string-quotes/task.md

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

33
---
44

@@ -14,4 +14,4 @@ alert( `olá ${1}` ); // ?
1414
alert( `olá ${"name"}` ); // ?
1515

1616
alert( `olá ${name}` ); // ?
17-
```
17+
```

1-js/02-first-steps/07-type-conversions/1-primitive-conversions-questions/task.md

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

33
---
44

@@ -23,4 +23,4 @@ null + 1
2323
undefined + 1
2424
```
2525

26-
Pense bem, escreva e depois compare com a resposta.
26+
Pense bem, escreva e depois compare com a resposta.

1-js/02-first-steps/08-operators/3-primitive-conversions-questions/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ undefined + 1 = NaN // (6)
2222
4. The subtraction always converts to numbers, so it makes `" -9 "` a number `-9` (ignoring spaces around it).
2323
5. `null` becomes `0` after the numeric conversion.
2424
6. `undefined` becomes `NaN` after the numeric conversion.
25-
7. Space characters, are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.
25+
7. Space characters are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.

1-js/02-first-steps/08-operators/article.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ The result of `a % b` is the [remainder](https://en.wikipedia.org/wiki/Remainder
5050
For instance:
5151

5252
```js run
53-
alert( 5 % 2 ); // 1, a remainder of 5 divided by 2
54-
alert( 8 % 3 ); // 2, a remainder of 8 divided by 3
53+
alert( 5 % 2 ); // 1, the remainder of 5 divided by 2
54+
alert( 8 % 3 ); // 2, the remainder of 8 divided by 3
55+
alert( 8 % 4 ); // 0, the remainder of 8 divided by 4
5556
```
5657

5758
### Exponentiation **
@@ -68,7 +69,7 @@ alert( 2 ** 3 ); // 2³ = 8
6869
alert( 2 ** 4 ); // 2⁴ = 16
6970
```
7071

71-
Just like in maths, the exponentiation operator is defined for non-integer numbers as well.
72+
Just like in maths, the exponentiation operator is defined for non-integer numbers as well.
7273

7374
For example, a square root is an exponentiation by ½:
7475

@@ -80,7 +81,7 @@ alert( 8 ** (1/3) ); // 2 (power of 1/3 is the same as a cubic root)
8081

8182
## String concatenation with binary +
8283

83-
Let's meet features of JavaScript operators that are beyond school arithmetics.
84+
Let's meet the features of JavaScript operators that are beyond school arithmetics.
8485
8586
Usually, the plus operator `+` sums numbers.
8687
@@ -194,18 +195,18 @@ Here's an extract from the [precedence table](https://developer.mozilla.org/en-U
194195
| Precedence | Name | Sign |
195196
|------------|------|------|
196197
| ... | ... | ... |
197-
| 15 | unary plus | `+` |
198-
| 15 | unary negation | `-` |
199-
| 14 | exponentiation | `**` |
200-
| 13 | multiplication | `*` |
201-
| 13 | division | `/` |
202-
| 12 | addition | `+` |
203-
| 12 | subtraction | `-` |
198+
| 14 | unary plus | `+` |
199+
| 14 | unary negation | `-` |
200+
| 13 | exponentiation | `**` |
201+
| 12 | multiplication | `*` |
202+
| 12 | division | `/` |
203+
| 11 | addition | `+` |
204+
| 11 | subtraction | `-` |
204205
| ... | ... | ... |
205206
| 2 | assignment | `=` |
206207
| ... | ... | ... |
207208

208-
As we can see, the "unary plus" has a priority of `15` which is higher than the `12` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
209+
As we can see, the "unary plus" has a priority of `14` which is higher than the `11` of "addition" (binary plus). That's why, in the expression `"+apples + +oranges"`, unary pluses work before the addition.
209210
210211
## Assignment
211212
@@ -303,9 +304,9 @@ Such operators have the same precedence as a normal assignment, so they run afte
303304
```js run
304305
let n = 2;
305306
306-
n *= 3 + 5;
307+
n *= 3 + 5; // right part evaluated first, same as n *= 8
307308
308-
alert( n ); // 16 (right part evaluated first, same as n *= 8)
309+
alert( n ); // 16
309310
```
310311

311312
## Increment/decrement
@@ -437,7 +438,7 @@ The list of operators:
437438
- RIGHT SHIFT ( `>>` )
438439
- ZERO-FILL RIGHT SHIFT ( `>>>` )
439440
440-
These operators are used very rarely, when we need to fiddle with numbers on the very lowest (bitwise) level. We won't need these operators any time soon, as web development has little use of them, but in some special areas, such as cryptography, they are useful. You can read the [Bitwise Operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise) chapter on MDN when a need arises.
441+
These operators are used very rarely, when we need to fiddle with numbers on the very lowest (bitwise) level. We won't need these operators any time soon, as web development has little use of them, but in some special areas, such as cryptography, they are useful. You can read the [Bitwise Operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#bitwise_operators) chapter on MDN when a need arises.
441442

442443
## Comma
443444

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

33
```js
4-
result = (a + b < 4) ? 'Below' : 'Over';
4+
let result = (a + b < 4) ? 'Below' : 'Over';
55
```
66

1-js/02-first-steps/10-ifelse/5-rewrite-if-question/task.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ importance: 5
44

55
# Rewrite 'if' into '?'
66

7-
Rewrite this `if` using the ternary operator `'?'`:
7+
Rewrite this `if` using the conditional operator `'?'`:
88

99
```js
10+
let result;
11+
1012
if (a + b < 4) {
1113
result = 'Below';
1214
} else {
1315
result = 'Over';
1416
}
1517
```
16-

0 commit comments

Comments
 (0)