Skip to content

Commit aba4471

Browse files
committed
merging all conflicts
2 parents 58c2842 + e92bb83 commit aba4471

File tree

459 files changed

+9914
-2797
lines changed

Some content is hidden

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

459 files changed

+9914
-2797
lines changed

1-js/01-getting-started/1-intro/article.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ Os scripts são fornecidos e executados como texto puro. Eles não precisam de p
1212

1313
Neste aspecto, o JavaScript é muito diferente de outra linguagem chamada [Java](https://pt.wikipedia.org/wiki/Java_(linguagem_de_programação)).
1414

15+
<<<<<<< HEAD
1516
```smart header="Por que <u>Java</u>Script?"
1617
Quando foi criado, inicialmente o JavaScript tinha outro nome: "LiveScript". Mas Java era muito popular naquela época, então foi decidido que posicionar uma nova linguagem como um "irmão mais novo" de Java ajudaria.
18+
=======
19+
```smart header="Why is it called <u>Java</u>Script?"
20+
When JavaScript was created, it initially had another name: "LiveScript". But Java was very popular at that time, so it was decided that positioning a new language as a "younger brother" of Java would help.
21+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
1722
1823
Mas à medida que ele evoluiu, o JavaScript se tornou uma linguagem totalmente independente com sua própria especificação chamada [ECMAScript] (http://en.wikipedia.org/wiki/ECMAScript), e agora ele não tem nenhuma relação com Java.
1924
```
@@ -38,7 +43,11 @@ Os interpretadores são complicados. Mas o básico é fácil.
3843
2. Depois converte ("compila") o script para a linguagem da máquina.
3944
3. E então o código da máquina é executado, bem rápido.
4045
46+
<<<<<<< HEAD
4147
O interpretador aplica otimizações em cada etapa do processo. Ele ainda observa o script compilado enquanto ele roda, analisa os dados que passam por ele e aplica otimizações ao código da máquina com base nesse conhecimento. Quando isso é feito, os scripts são executados rapidamente.
48+
=======
49+
The engine applies optimizations at each step of the process. It even watches the compiled script as it runs, analyzes the data that flows through it, and further optimizes the machine code based on that knowledge.
50+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
4251
```
4352

4453
## O que o JavaScript no navegador pode fazer?
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
# Manuals and specifications
3+
4+
This book is a *tutorial*. It aims to help you gradually learn the language. But once you're familiar with the basics, you'll need other sources.
5+
6+
## Specification
7+
8+
[The ECMA-262 specification](https://www.ecma-international.org/publications/standards/Ecma-262.htm) contains the most in-depth, detailed and formalized information about JavaScript. It defines the language.
9+
10+
But being that formalized, it's difficult to understand at first. So if you need the most trustworthy source of information about the language details, the specification is the right place. But it's not for everyday use.
11+
12+
A new specification version is released every year. In-between these releases, the latest specification draft is at <https://tc39.es/ecma262/>.
13+
14+
To read about new bleeding-edge features, including those that are "almost standard" (so-called "stage 3"), see proposals at <https://github.com/tc39/proposals>.
15+
16+
Also, if you're in developing for the browser, then there are other specs covered in the [second part](info:browser-environment) of the tutorial.
17+
18+
## Manuals
19+
20+
- **MDN (Mozilla) JavaScript Reference** is a manual with examples and other information. It's great to get in-depth information about individual language functions, methods etc.
21+
22+
One can find it at <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>.
23+
24+
Although, it's often best to use an internet search instead. Just use "MDN [term]" in the query, e.g. <https://google.com/search?q=MDN+parseInt> to search for `parseInt` function.
25+
26+
27+
- **MSDN** – Microsoft manual with a lot of information, including JavaScript (often referred to as JScript). If one needs something specific to Internet Explorer, better go there: <http://msdn.microsoft.com/>.
28+
29+
Also, we can use an internet search with phrases such as "RegExp MSDN" or "RegExp MSDN jscript".
30+
31+
## Compatibility tables
32+
33+
JavaScript is a developing language, new features get added regularly.
34+
35+
To see their support among browser-based and other engines, see:
36+
37+
- <http://caniuse.com> - per-feature tables of support, e.g. to see which engines support modern cryptography functions: <http://caniuse.com/#feat=cryptography>.
38+
- <https://kangax.github.io/compat-table> - a table with language features and engines that support those or don't support.
39+
40+
All these resources are useful in real-life development, as they contain valuable information about language details, their support etc.
41+
42+
Please remember them (or this page) for the cases when you need in-depth information about a particular feature.

1-js/01-getting-started/3-code-editors/article.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,15 @@ A principal diferença entre um "editor leve" e uma "IDE", é que uma IDE trabal
3131

3232
Na prática, os editores leves podem ter muitos plug-ins, incluindo analisadores de sintaxe no nível de diretório e preenchimentos automáticos, portanto não há uma limitação rígida entre um editor leve e uma IDE.
3333

34+
<<<<<<< HEAD
3435
As seguintes opções merecem sua atenção:
36+
=======
37+
- [Atom](https://atom.io/) (cross-platform, free).
38+
- [Visual Studio Code](https://code.visualstudio.com/) (cross-platform, free).
39+
- [Sublime Text](http://www.sublimetext.com) (cross-platform, shareware).
40+
- [Notepad++](https://notepad-plus-plus.org/) (Windows, free).
41+
- [Vim](http://www.vim.org/) and [Emacs](https://www.gnu.org/software/emacs/) are also cool if you know how to use them.
42+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
3543
3644
- [Visual Studio Code](https://code.visualstudio.com/) (plataforma cruzada, livre) também tem muitos recursos similares a IDE.
3745
- [Atom](https://atom.io/) (multi-plataforma, livre).

1-js/01-getting-started/4-devtools/article.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,23 @@ O aspecto exato das ferramentas de desenvolvimento depende da sua versão do Chr
2929
- Aqui podemos ver a mensagem de erro de cor vermelha. Neste caso, o script contém um comando "lalala" desconhecido.
3030
- À direita, há um link clicável para o código-fonte `bug.html:12` com o número da linha onde o erro ocorreu.
3131

32+
<<<<<<< HEAD
3233
Abaixo da mensagem de erro, há um símbolo azul `>`. Ele marca uma "linha de comando" onde podemos digitar comandos JavaScript. Pressione `key:Enter` para executá-los (`key:Shift+Enter` para introduzir comandos multi-linha).
34+
=======
35+
Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them.
36+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
3337
3438
Agora podemos ver erros, e isso é suficiente para começar. Voltaremos mais tarde às ferramentas de desenvolvedor e abordaremos a depuração mais profundamente no capítulo <info:debugging-chrome>.
3539

40+
<<<<<<< HEAD
3641
## Firefox, Edge, e outros
42+
=======
43+
```smart header="Multi-line input"
44+
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.
45+
46+
To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
47+
```
48+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
3749
3850
A maioria dos outros navegadores usam `key:F12` para abrir ferramentas de desenvolvimento.
3951

@@ -51,11 +63,15 @@ Agora o `key:Cmd+Opt+C` pode alternar o console. Além disso, note que o novo it
5163

5264
## Entrada multi-linha
5365

66+
<<<<<<< HEAD
5467
Normalmente, quando colocamos uma linha de código no console, e então pressionamos `key:Enter`, ele executa.
5568

5669
Para inserir várias linhas, pressione `key:Shift+Enter`.
5770

5871
## Resumo
72+
=======
73+
## Summary
74+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
5975
6076
- As ferramentas de desenvolvedor nos permitem ver erros, executar comandos, examinar variáveis e muito mais.
6177
- Elas podem ser abertas com `key:F12` para a maioria dos navegadores no Windows. O Chrome para Mac precisa de `key:Cmd+Opt+J`, Safari: `key:Cmd+Opt+C` (precisa ser ativado primeiro).

1-js/02-first-steps/01-hello-world/article.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ Comentários antes e depois dos scripts.
6060
//--></script>
6161
```
6262

63+
<<<<<<< HEAD
6364
Esse truque não é usado no JavaScript moderno. Esses comentários esconderam código JavaScript de navegadores antigos que não sabiam como processar a tag `<script>`. Como os navegadores lançados nos últimos 15 anos não têm esse problema, esse tipo de comentário pode ajudá-lo a identificar códigos realmente antigos.
65+
=======
66+
This trick isn't used in modern JavaScript. These comments hide JavaScript code from old browsers that didn't know how to process the `<script>` tag. Since browsers released in the last 15 years don't have this issue, this kind of comment can help you identify really old code.
67+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
6468
6569

6670
## Scripts externos

1-js/02-first-steps/03-strict-mode/article.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,18 @@ Apenas comentários devem aparecer acima de `"use strict"`.
3939

4040
## Console do navegador
4141

42+
<<<<<<< HEAD
4243
Para o futuro, quando você usar o console do navegador para testar funcionalidades, observe que ele não "usa strict" por padrão.
44+
=======
45+
Once we enter strict mode, there's no going back.
46+
```
47+
48+
## Browser console
49+
50+
For the future, when you use a browser console to test features, please note that it doesn't `use strict` by default.
51+
52+
Sometimes, when `use strict` makes a difference, you'll get incorrect results.
53+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
4354
4455
As vezes, quando usar `use strict` faz alguma diferença, você terá resultados incorretos.
4556

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ Uma [variável](https://pt.wikipedia.org/wiki/Variável_(programação)) é um "
1212

1313
Para criar uma variável em JavaScript, use a palavra-chave `let`.
1414

15+
<<<<<<< HEAD
1516
A declaração abaixo cria (em outras palavras: * declara * ou * define *) uma variável com o nome "message":
17+
=======
18+
The statement below creates (in other words: *declares*) a variable with the name "message":
19+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
1620
1721
```js
1822
let message;
@@ -237,7 +241,11 @@ Para declarar uma variável constante (imutável), use `const` em vez de `let`:
237241
const myBirthday = '18.04.1982';
238242
```
239243
244+
<<<<<<< HEAD
240245
Variáveis declaradas usando `const` são chamadas de "constantes". Elas não podem ser alteradas. Uma tentativa de fazer isso causaria um erro:
246+
=======
247+
Variables declared using `const` are called "constants". They cannot be reassigned. An attempt to do so would cause an error:
248+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
241249
242250
```js run
243251
const myBirthday = '18.04.1982';
@@ -290,7 +298,11 @@ Em outras palavras, constantes com nomes maiúsculos são usadas apenas como pse
290298
291299
Falando em variáveis, há mais uma coisa extremamente importante.
292300
301+
<<<<<<< HEAD
293302
Por favor, nomeie as suas variáveis de forma sensata. Tome tempo para pensar sobre isso.
303+
=======
304+
A variable name should have a clean, obvious meaning, describing the data that it stores.
305+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
294306
295307
A nomenclatura variável é uma das habilidades mais importantes e complexas em programação. Uma rápida olhada em nomes de variáveis pode revelar qual código foi escrito por um iniciante versus um desenvolvedor experiente.
296308

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

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ message = 123456;
1010

1111
As linguagens de programação que permitem tais coisas são chamadas "dinamicamente tipadas", o que significa que existem tipos de dados, mas as variáveis não estão vinculadas a nenhum deles.
1212

13+
<<<<<<< HEAD
1314
Há sete tipos de dados básicos em JavaScript. Aqui, vamos cobri-los em geral e nos próximos capítulos vamos falar sobre cada um deles em detalhe.
1415

1516
## Um número
17+
=======
18+
There are eight basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.
19+
20+
## Number
21+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
1622
1723
```js
1824
let n = 123;
@@ -62,14 +68,43 @@ Os valores numéricos especiais pertencem formalmente ao tipo "número". Claro q
6268

6369
Veremos mais sobre como trabalhar com números no capítulo <info:number>.
6470

71+
<<<<<<< HEAD
6572
## Uma string
73+
=======
74+
## BigInt
75+
76+
In JavaScript, the "number" type cannot represent integer values larger than <code>2<sup>53</sup></code> (or less than <code>-2<sup>53</sup></code> for negatives), that's a technical limitation caused by their internal representation. That's about 16 decimal digits, so for most purposes the limitation isn't a problem, but sometimes we need really big numbers, e.g. for cryptography or microsecond-precision timestamps.
77+
78+
`BigInt` type was recently added to the language to represent integers of arbitrary length.
79+
80+
A `BigInt` is created by appending `n` to the end of an integer literal:
81+
82+
```js
83+
// the "n" at the end means it's a BigInt
84+
const bigInt = 1234567890123456789012345678901234567890n;
85+
```
86+
87+
As `BigInt` numbers are rarely needed, we devoted them a separate chapter <info:bigint>.
88+
89+
```smart header="Compatability issues"
90+
Right now `BigInt` is supported in Firefox and Chrome, but not in Safari/IE/Edge.
91+
```
92+
93+
## String
94+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
6695
6796
Uma string em JavaScript deve estar entre aspas.
6897

6998
```js
99+
<<<<<<< HEAD
70100
let str = "Olá";
71101
let str2 = 'Aspas simples também são ok';
72102
let phrase = `pode incorporar ${str}`;
103+
=======
104+
let str = "Hello";
105+
let str2 = 'Single quotes are ok too';
106+
let phrase = `can embed another ${str}`;
107+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
73108
```
74109

75110
Em JavaScript, existem 3 tipos de citações.
@@ -78,7 +113,11 @@ Em JavaScript, existem 3 tipos de citações.
78113
2. Aspas simples: `'Olá'`.
79114
3. Backticks: <code>&#96;Olá&#96;</code>.
80115

116+
<<<<<<< HEAD
81117
Aspas duplas e simples são citações "simples". Não há diferença entre elas em JavaScript.
118+
=======
119+
Double and single quotes are "simple" quotes. There's practically no difference between them in JavaScript.
120+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
82121
83122
Backticks são citações de "funcionalidade estendida". Eles nos permitem incorporar variáveis e expressões em uma string envolvendo-as em `$ {…}`, por exemplo:
84123

@@ -101,13 +140,22 @@ alert( "o resultado é ${1 + 2}" ); // o resultado é ${1 + 2} (aspas duplas nã
101140

102141
Abordaremos as strings mais detalhadamente no capítulo <info:string>.
103142

143+
<<<<<<< HEAD
104144
```smart header="Não há nenhum tipo de *caractere*."
105145
Em algumas linguagens, existe um tipo especial de "caractere" para um único caractere. Por exemplo, na linguagem C e em Java é `char`.
146+
=======
147+
```smart header="There is no *character* type."
148+
In some languages, there is a special "character" type for a single character. For example, in the C language and in Java it is called "char".
149+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
106150
107151
Em JavaScript, não existe tal tipo. Existe apenas um tipo: `string`. Uma string pode consistir de apenas um caractere ou muitos deles.
108152
```
109153

154+
<<<<<<< HEAD
110155
## Um booleano (tipo lógico)
156+
=======
157+
## Boolean (logical type)
158+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
111159
112160
O tipo booleano tem apenas dois valores: `true` e `false`.
113161

@@ -198,6 +246,8 @@ typeof undefined // "undefined"
198246

199247
typeof 0 // "number"
200248

249+
typeof 10n // "bigint"
250+
201251
typeof true // "boolean"
202252

203253
typeof "foo" // "string"
@@ -223,6 +273,7 @@ As três últimas linhas podem precisar de explicações adicionais:
223273
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.
224274
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.
225275

276+
<<<<<<< HEAD
226277

227278
## Resumo
228279

@@ -235,6 +286,20 @@ Existem 7 tipos básicos em JavaScript.
235286
- `undefined` para valores não atribuídos -- um tipo autônomo que tem um único valor `undefined`.
236287
- `object` para estruturas de dados mais complexas.
237288
- `symbol` para identificadores exclusivos.
289+
=======
290+
## Summary
291+
292+
There are 8 basic data types in JavaScript.
293+
294+
- `number` for numbers of any kind: integer or floating-point, integers are limited by ±2<sup>53</sup>.
295+
- `bigint` is for integer numbers of arbitrary length.
296+
- `string` for strings. A string may have one or more characters, there's no separate single-character type.
297+
- `boolean` for `true`/`false`.
298+
- `null` for unknown values -- a standalone type that has a single value `null`.
299+
- `undefined` for unassigned values -- a standalone type that has a single value `undefined`.
300+
- `object` for more complex data structures.
301+
- `symbol` for unique identifiers.
302+
>>>>>>> e92bb83e995dfea982dcdc5065036646bfca13f0
238303
239304
O operador `typeof` nos permite ver qual tipo é armazenado em uma variável.
240305

1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)