Skip to content

Commit 2d84f69

Browse files
committed
Merge branch 'update-switch' into switch
2 parents c8e18ce + 95fa690 commit 2d84f69

File tree

330 files changed

+32698
-2060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

330 files changed

+32698
-2060
lines changed
File renamed without changes.

1-js/02-first-steps/05-types/article.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Além dos números regulares, existem os chamados "valores numéricos especiais"
3838
```js run
3939
alert( Infinity ); // Infinito
4040
```
41+
4142
- `NaN` representa um erro computacional. É o resultado de uma operação matemática incorreta ou indefinida, por exemplo:
4243

4344
```js run
@@ -95,6 +96,7 @@ alert( `o resultado é *!*${1 + 2}*/!*` ); // o resultado é 3
9596
A expressão dentro de `${…}` é avaliada e o resultado torna-se uma parte da string. Podemos colocar qualquer coisa lá: uma variável como `name` ou uma expressão aritmética como `1 + 2` ou algo mais complexo.
9697

9798
Por favor, note que isso só pode ser feito com backticks. Outras citações não têm esta funcionalidade de incorporação!
99+
98100
```js run
99101
alert( "o resultado é ${1 + 2}" ); // o resultado é ${1 + 2} (aspas duplas não fazem nada)
100102
```
@@ -223,7 +225,6 @@ As três últimas linhas podem precisar de explicações adicionais:
223225
2. O resultado de `typeof null` é `"object"`. Isso é errado. É um erro oficialmente reconhecido em `typeof`, mantido para compatibilidade. Naturalmente, `null` não é um objeto. É um valor especial com um tipo separado próprio. Assim, outra vez, este é um erro na linguagem.
224226
3. O resultado de `typeof alert` é `"function"`, porque `alert` é uma função da linguagem. Vamos estudar as funções nos próximos capítulos onde veremos que não há nenhum tipo de "função" especial em JavaScript. As funções pertencem ao tipo de objecto. Mas o `typeof` trata-as de forma diferente. Formalmente, é incorrecto, mas muito conveniente na prática.
225227

226-
227228
## Resumo
228229

229230
Existem 7 tipos básicos em JavaScript.
@@ -242,4 +243,4 @@ O operador `typeof` nos permite ver qual tipo é armazenado em uma variável.
242243
- Retorna uma string com o nome do tipo, como `"string"`.
243244
- Para `null` retorna `"object"` -- isso é um erro na linguagem, não é realmente um objeto.
244245

245-
Nos próximos capítulos, nos concentraremos nos valores primitivos e, uma vez familiarizados com eles, passaremos para os objetos.
246+
Nos próximos capítulos, nos concentraremos nos valores primitivos e, uma vez familiarizados com eles, passaremos para os objetos.
File renamed without changes.
File renamed without changes.

1-js/02-first-steps/09-alert-prompt-confirm/article.md renamed to 1-js/02-first-steps/06-alert-prompt-confirm/article.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
# Interaction: alert, prompt, confirm
22

3-
This part of the tutorial aims to cover JavaScript "as is", without environment-specific tweaks.
4-
5-
But we'll still be using the browser as our demo environment, so we should know at least a few of its user-interface functions. In this chapter, we'll get familiar with the browser functions `alert`, `prompt` and `confirm`.
3+
As we'll be using the browser as our demo environment, let's see a couple of functions to interact with the user: `alert`, `prompt` and `confirm`.
64

75
## alert
86

9-
Syntax:
10-
11-
```js
12-
alert(message);
13-
```
14-
15-
This shows a message and pauses script execution until the user presses "OK".
7+
This one we've seen already. It shows a message and waits for the user to presses "OK".
168

179
For example:
1810

1911
```js run
2012
alert("Hello");
2113
```
2214

23-
The mini-window with the message is called a *modal window*. The word "modal" means that the visitor can't interact with the rest of the page, press other buttons, etc. until they have dealt with the window. In this case -- until they press "OK".
15+
The mini-window with the message is called a *modal window*. The word "modal" means that the visitor can't interact with the rest of the page, press other buttons, etc, until they have dealt with the window. In this case -- until they press "OK".
2416

2517
## prompt
2618

@@ -30,15 +22,19 @@ The function `prompt` accepts two arguments:
3022
result = prompt(title, [default]);
3123
```
3224

33-
It shows a modal window with a text message, an input field for the visitor, and the buttons OK/CANCEL.
25+
It shows a modal window with a text message, an input field for the visitor, and the buttons OK/Cancel.
3426

3527
`title`
3628
: The text to show the visitor.
3729

3830
`default`
3931
: An optional second parameter, the initial value for the input field.
4032

41-
The visitor may type something in the prompt input field and press OK. Or they can cancel the input by pressing CANCEL or hitting the `key:Esc` key.
33+
```smart header="The square brackets in syntax `[...]`"
34+
The square brackets around `default` in the syntax above denote that the parameter as optional, not required.
35+
```
36+
37+
The visitor can type something in the prompt input field and press OK. Then we get that text in the `result`. Or they can cancel the input by pressing Cancel or hitting the `key:Esc` key, then we get `null` as the `result`.
4238
4339
The call to `prompt` returns the text from the input field or `null` if the input was canceled.
4440
@@ -74,7 +70,7 @@ The syntax:
7470
result = confirm(question);
7571
```
7672
77-
The function `confirm` shows a modal window with a `question` and two buttons: OK and CANCEL.
73+
The function `confirm` shows a modal window with a `question` and two buttons: OK and Cancel.
7874
7975
The result is `true` if OK is pressed and `false` otherwise.
8076
@@ -94,10 +90,10 @@ We covered 3 browser-specific functions to interact with visitors:
9490
: shows a message.
9591
9692
`prompt`
97-
: shows a message asking the user to input text. It returns the text or, if CANCEL or `key:Esc` is clicked, `null`.
93+
: shows a message asking the user to input text. It returns the text or, if Cancel button or `key:Esc` is clicked, `null`.
9894
9995
`confirm`
100-
: shows a message and waits for the user to press "OK" or "CANCEL". It returns `true` for OK and `false` for CANCEL/`key:Esc`.
96+
: shows a message and waits for the user to press "OK" or "Cancel". It returns `true` for OK and `false` for Cancel/`key:Esc`.
10197
10298
All these methods are modal: they pause script execution and don't allow the visitor to interact with the rest of the page until the window has been dismissed.
10399
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)