You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/01-getting-started/1-intro/article.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,11 +106,20 @@ Ferramentas modernas tornam a transpilação muito rápida e transparente, permi
106
106
107
107
Exemplos de tais linguagens:
108
108
109
+
<<<<<<< HEAD
109
110
-[CoffeeScript](http://coffeescript.org/) é um "açúcar sintático" para JavaScript. Ele introduz uma sintaxe mais curta, permitindo-nos escrever um código mais claro e preciso. Normalmente, Ruby devs gostam dele.
110
111
-[TypeScript](http://www.typescriptlang.org/) está concentrado em adicionar "estritos tipos de dados" para simplificar o desenvolvimento e suporte de sistemas complexos. É desenvolvido pela Microsoft.
111
112
-[Flow](http://flow.org/) também adiciona tipos de dados, mas de uma forma diferente. Desenvolvido pela Facebook.
112
113
-[Dart](https://www.dartlang.org/) é uma linguagem autônoma que tem seu próprio interpretador que roda em ambientes fora do navegador (como aplicativos móveis), mas também pode ser transpilada para JavaScript. Desenvolvido pela Google.
113
114
-[Brython](https://brython.info/) é um transpilador de Python para JavaScript que permite escrever aplicativos em puro Python, sem JavaScript.
115
+
=======
116
+
-[CoffeeScript](http://coffeescript.org/) is a "syntactic sugar" for JavaScript. It introduces shorter syntax, allowing us to write clearer and more precise code. Usually, Ruby devs like it.
117
+
-[TypeScript](http://www.typescriptlang.org/) is concentrated on adding "strict data typing" to simplify the development and support of complex systems. It is developed by Microsoft.
118
+
-[Flow](http://flow.org/) also adds data typing, but in a different way. Developed by Facebook.
119
+
-[Dart](https://www.dartlang.org/) is a standalone language that has its own engine that runs in non-browser environments (like mobile apps), but also can be transpiled to JavaScript. Developed by Google.
120
+
-[Brython](https://brython.info/) is a Python transpiler to JavaScript that enables the writing of applications in pure Python without JavaScript.
121
+
-[Kotlin](https://kotlinlang.org/docs/js-overview.html) is a modern, concise and safe programming language that can target the browser or Node.
122
+
>>>>>>> 039716de8a96f49b5fccd7aed5effff2e719dfe5
114
123
115
124
Há mais. Claro que, mesmo que usemos uma dessas linguagens transpiladas, também devemos saber JavaScript para entender o que estamos fazendo.
Copy file name to clipboardExpand all lines: 1-js/04-object-basics/07-optional-chaining/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -219,4 +219,4 @@ As we can see, all of them are straightforward and simple to use. The `?.` check
219
219
220
220
A chain of `?.` allows to safely access nested properties.
221
221
222
-
Still, we should apply `?.` carefully, only where it's acceptable that the left part doesn't to exist. So that it won't hide programming errors from us, if they occur.
222
+
Still, we should apply `?.` carefully, only where it's acceptable that the left part doesn't exist. So that it won't hide programming errors from us, if they occur.
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/04-var/article.md
+18-2Lines changed: 18 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,23 @@ alert(test); // true, the variable lives after if
42
42
*/!*
43
43
```
44
44
45
+
<<<<<<< HEAD
45
46
If we used `let test` on the 2nd line, then it wouldn't be visible to `alert`. But `var` ignores code blocks, so we've got a global `test`.
47
+
=======
48
+
As `var` ignores code blocks, we've got a global variable `test`.
49
+
50
+
If we used `let test` instead of `var test`, then the variable would only be visible inside `if`:
51
+
52
+
```js run
53
+
if (true) {
54
+
let test =true; // use "let"
55
+
}
56
+
57
+
*!*
58
+
alert(test); // ReferenceError: test is not defined
59
+
*/!*
60
+
```
61
+
>>>>>>> 039716de8a96f49b5fccd7aed5effff2e719dfe5
46
62
47
63
The same thing for loops: `var` cannot be block- or loop-local:
48
64
@@ -70,7 +86,7 @@ function sayHi() {
70
86
}
71
87
72
88
sayHi();
73
-
alert(phrase); //Error: phrase is not defined
89
+
alert(phrase); //ReferenceError: phrase is not defined
74
90
```
75
91
76
92
As we can see, `var` pierces through `if`, `for` or other code blocks. That's because a long time ago in JavaScript, blocks had no Lexical Environments, and `var` is a remnant of that.
@@ -216,7 +232,7 @@ The Function Expression is wrapped with parenthesis `(function {...})`, because
216
232
217
233
```js run
218
234
// Tries to declare and immediately call a function
219
-
function() { // <-- Error: Function statements require a function name
235
+
function() { // <-- SyntaxError: Function statements require a function name
Copy file name to clipboardExpand all lines: 1-js/11-async/07-microtask-queue/article.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Why did the `.then` trigger afterwards? What's going on?
23
23
24
24
# Microtasks
25
25
26
-
Asynchronous tasks need proper management. For that, the ECMA standard specifies an internal queue `PromiseJobs`, more often referred to as the "microtask queue" (ES8 term).
26
+
Asynchronous tasks need proper management. For that, the ECMA standard specifies an internal queue `PromiseJobs`, more often referred to as the "microtask queue" (V8 term).
27
27
28
28
As stated in the [specification](https://tc39.github.io/ecma262/#sec-jobs-and-job-queues):
29
29
@@ -179,7 +179,7 @@ In the example above, `.catch` added by `setTimeout` also triggers. But it does
179
179
180
180
- There's also a "macrotask queue" that keeps various events, network operation results, `setTimeout`-scheduled calls, and so on. These are also called "macrotasks" (v8 term).
181
181
182
-
Promise handling is always asynchronous, as all promise actions pass through the internal "promise jobs" queue, also called "microtask queue" (ES8 term).
182
+
Promise handling is always asynchronous, as all promise actions pass through the internal "promise jobs" queue, also called "microtask queue" (V8 term).
183
183
184
184
So `.then/catch/finally` handlers are always called after the current code is finished.
Copy file name to clipboardExpand all lines: 2-ui/1-document/04-searching-elements-dom/article.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,7 @@ For instance:
142
142
143
143
*Ancestors* of an element are: parent, the parent of parent, its parent and so on. The ancestors together form the chain of parents from the element to the top.
144
144
145
-
The method `elem.closest(css)` looks the nearest ancestor that matches the CSS-selector. The `elem` itself is also included in the search.
145
+
The method `elem.closest(css)` looks for the nearest ancestor that matches the CSS-selector. The `elem` itself is also included in the search.
146
146
147
147
In other words, the method `closest` goes up from the element and checks each of parents. If it matches the selector, then the search stops, and the ancestor is returned.
Copy file name to clipboardExpand all lines: 2-ui/3-event-details/7-keyboard-events/article.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -170,6 +170,12 @@ In the past, there was a `keypress` event, and also `keyCode`, `charCode`, `whic
170
170
171
171
There were so many browser incompatibilities while working with them, that developers of the specification had no way, other than deprecating all of them and creating new, modern events (described above in this chapter). The old code still works, as browsers keep supporting them, but there's totally no need to use those any more.
172
172
173
+
## Mobile Keyboards
174
+
175
+
When using virtual/mobile keyboards, formally known as IME (Input-Method Editor), the W3C standard states that a KeyboardEvent's [`e.keyCode` should be `229`](https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode) and [`e.key` should be `"Unidentified"`](https://www.w3.org/TR/uievents-key/#key-attr-values).
176
+
177
+
While some of these keyboards might still use the right values for `e.key`, `e.code`, `e.keyCode`... when pressing certain keys such as arrows or backspace, there's no guarantee, so your keyboard logic might not always work on mobile devices.
178
+
173
179
## Summary
174
180
175
181
Pressing a key always generates a keyboard event, be it symbol keys or special keys like `key:Shift` or `key:Ctrl` and so on. The only exception is `key:Fn` key that sometimes presents on a laptop keyboard. There's no keyboard event for it, because it's often implemented on lower level than OS.
let results =awaitPromise.all([...fetchJobs, ourJob]);
139
139
140
-
// if controller.abort() is called from elsewhere,
140
+
// if controller.abort() is called from anywhere,
141
141
// it aborts all fetches and ourJob
142
142
```
143
143
144
144
## Summary
145
145
146
-
-`AbortController` is a simple object that generates `abort` event on it's `signal` property when `abort()` method is called (and also sets `signal.aborted` to `true`).
147
-
-`fetch` integrates with it: we pass `signal` property as the option, and then `fetch` listens to it, so it becomes possible to abort the `fetch`.
146
+
-`AbortController` is a simple object that generates an `abort` event on it's `signal` property when the`abort()` method is called (and also sets `signal.aborted` to `true`).
147
+
-`fetch` integrates with it: we pass the `signal` property as the option, and then `fetch` listens to it, so it's possible to abort the `fetch`.
148
148
- We can use `AbortController` in our code. The "call `abort()`" -> "listen to `abort` event" interaction is simple and universal. We can use it even without `fetch`.
Copy file name to clipboardExpand all lines: 5-network/07-url/article.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ Here's the cheatsheet for URL components:
65
65
```smart header="We can pass `URL` objects to networking (and most other) methods instead of a string"
66
66
We can use a `URL` object in `fetch` or `XMLHttpRequest`, almost everywhere where a URL-string is expected.
67
67
68
-
Generally, `URL` object can be passed to any method instead of a string, as most method will perform the string conversion, that turns a `URL` object into a string with full URL.
68
+
Generally, the `URL` object can be passed to any method instead of a string, as most methods will perform the string conversion, that turns a `URL` object into a string with full URL.
69
69
```
70
70
71
71
## SearchParams "?..."
@@ -80,7 +80,7 @@ new URL('https://google.com/search?query=JavaScript')
80
80
81
81
...But parameters need to be encoded if they contain spaces, non-latin letters, etc (more about that below).
82
82
83
-
So there's URL property for that: `url.searchParams`, an object of type [URLSearchParams](https://url.spec.whatwg.org/#urlsearchparams).
83
+
So there's a URL property for that: `url.searchParams`, an object of type [URLSearchParams](https://url.spec.whatwg.org/#urlsearchparams).
84
84
85
85
It provides convenient methods for search parameters:
86
86
@@ -201,7 +201,7 @@ So we should use only `encodeURIComponent` for each search parameter, to correct
201
201
````smart header="Encoding difference compared to `URL`"
202
202
Classes [URL](https://url.spec.whatwg.org/#url-class) and [URLSearchParams](https://url.spec.whatwg.org/#interface-urlsearchparams) are based on the latest URI specification: [RFC3986](https://tools.ietf.org/html/rfc3986), while `encode*` functions are based on the obsolete version [RFC2396](https://www.ietf.org/rfc/rfc2396.txt).
203
203
204
-
There are few differences, e.g. IPv6 addresses are encoded differently:
204
+
There are a few differences, e.g. IPv6 addresses are encoded differently:
0 commit comments