Skip to content

Sync with upstream @ fe571b36 #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 95 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
edfe300
Update article.md
rromanenko Jun 23, 2020
4044b75
Fix typo
dvdvdmt Jun 27, 2020
97a12c4
Update article.md
akymtl Jun 27, 2020
1b1b07e
Update article.md
akymtl Jun 27, 2020
41a1b92
Fix typo in /instanceof section (widow -> Window)
traxium Jun 28, 2020
01e584f
update solution.md
DanGhanbari Jun 28, 2020
74caa86
Typos
peachesontour Jun 30, 2020
de25423
Typos
peachesontour Jun 30, 2020
3e2309c
Update article.md
liuernan Jul 1, 2020
ad0dd99
is 'if' operator?
lumosmind Jul 1, 2020
3eb13d5
Corrected a typo
SakiPgr Jul 2, 2020
eb49cb9
Type mistake
pushpend3r Jul 2, 2020
f0dbc65
Fixed Type
siddharth-golchha Jul 4, 2020
5ac5183
more definitive title
lumosmind Jul 4, 2020
d9ab352
Update article.md
shubham-maurya Jul 5, 2020
8a9f440
Fix error of BigInt
leviding Jul 6, 2020
1ad3c2c
Correct message in sandbox.view iframe
smakhl Jul 7, 2020
23fb044
Update task.md
leviding Jul 7, 2020
9e3065f
Fix a comment
zhang1pr Jul 9, 2020
3852623
8.4 Prototype methods... - Fix code typo
DaliborP Jul 10, 2020
15214dc
Update article.md
haond10adp Jul 10, 2020
56edf4a
minor fix: precedence is 5 according to MDN
mazharz Jul 11, 2020
72482bc
Update article.md
paroche Jul 16, 2020
de13faf
Update bindAll of lodash
leviding Jul 17, 2020
0b7266d
Browser LocalStorage capacity updated to 5 MB.
Pankajtanwarbanna Jul 17, 2020
dfcacf2
Fix minor typo error: ol number
leviding Jul 18, 2020
7480a24
Fix minor typo error: add ol number
leviding Jul 18, 2020
356d527
Fix minor typo error: change when when to when
leviding Jul 18, 2020
0d497c7
Update article.md
leviding Jul 18, 2020
d0474ae
Update article.md
leviding Jul 18, 2020
6800c2a
Update index.html
leviding Jul 18, 2020
3558415
Merge pull request #1977 from peachesontour/patch-1
iliakan Jul 18, 2020
841d750
Merge pull request #2014 from leviding/patch-20
iliakan Jul 18, 2020
55f825c
Merge pull request #2013 from leviding/patch-19
iliakan Jul 18, 2020
b947777
Merge pull request #2012 from leviding/patch-18
iliakan Jul 18, 2020
df9effe
Merge pull request #2011 from Pankajtanwarbanna/patch-1
iliakan Jul 18, 2020
ffbf1a8
Merge pull request #2010 from leviding/patch-17
iliakan Jul 18, 2020
1f6b1c7
Merge pull request #2003 from m47h4r/minor-fix-nullish-coalescing-ope…
iliakan Jul 18, 2020
859fc13
Merge pull request #2001 from haond10adp/master
iliakan Jul 18, 2020
b4dfc5d
Merge pull request #2000 from DaliborP/patch-1
iliakan Jul 18, 2020
6e0944a
Merge pull request #1999 from zhang1pr/master
iliakan Jul 18, 2020
4716d10
Merge pull request #1997 from leviding/patch-15
iliakan Jul 18, 2020
c1767e7
Merge pull request #1996 from smakhl/patch-1
iliakan Jul 18, 2020
a896d3c
Merge pull request #1995 from leviding/patch-14
iliakan Jul 18, 2020
83c01f4
Merge pull request #1993 from shubham-maurya/patch-1
iliakan Jul 18, 2020
5641b17
Merge pull request #1989 from siddharth-golchha/patch-1
iliakan Jul 18, 2020
80f7653
Merge pull request #1987 from pushpend3r/patch-1
iliakan Jul 18, 2020
67e54bf
Merge pull request #1984 from SakiPgr/patch-1
iliakan Jul 18, 2020
e251f05
Merge pull request #1983 from lumosmind/patch-40
iliakan Jul 18, 2020
918947e
Merge pull request #1980 from liuernan/patch-1
iliakan Jul 18, 2020
86222ff
Merge pull request #1978 from peachesontour/patch-2
iliakan Jul 18, 2020
83793dc
Merge pull request #1976 from DanGhanbari/patch-1
iliakan Jul 18, 2020
5e74d7c
Merge pull request #1975 from traxium/patch-1
iliakan Jul 18, 2020
04c0570
Merge pull request #1974 from akymtl/patch-3
iliakan Jul 18, 2020
6acac10
Merge pull request #1973 from akymtl/patch-1
iliakan Jul 18, 2020
668207b
Merge pull request #1972 from dvdvdmt/patch-1
iliakan Jul 18, 2020
ae11710
Merge pull request #1970 from rromanenko/patch-1
iliakan Jul 18, 2020
4fdf4c3
to make binding more clear
lumosmind Jul 21, 2020
b70f949
grammatical fix
lumosmind Jul 21, 2020
f38eb4e
Merge pull request #2021 from lumosmind/patch-44
iliakan Jul 21, 2020
41766c9
grammar fix
lumosmind Jul 23, 2020
8e1f438
Merge pull request #1990 from lumosmind/patch-43
iliakan Jul 23, 2020
dc0d915
Typo
peachesontour Jul 25, 2020
b0464bb
Merge pull request #2028 from peachesontour/patch-1
iliakan Jul 25, 2020
05e1878
refactoring
lumosmind Jul 29, 2020
cdf382d
Merge pull request #2031 from lumosmind/patch-49
iliakan Jul 29, 2020
0f391b2
Update article.md
iliakan Aug 3, 2020
0f7443b
minor fixes
iliakan Aug 4, 2020
4133532
minor fixes
iliakan Aug 4, 2020
0e592a9
minor fixes
iliakan Aug 4, 2020
d2f7d14
minor fixes
iliakan Aug 4, 2020
fb4dda6
minor fixes
iliakan Aug 4, 2020
f0ad0ba
minor fixes
iliakan Aug 4, 2020
7907cd6
minor fixes
iliakan Aug 4, 2020
7b0d477
repeated word
joaquinelio Aug 8, 2020
d4fb59b
Merge pull request #2046 from joaquinelio/patch-1
iliakan Aug 8, 2020
bb8fc43
Typos
peachesontour Aug 8, 2020
1599dec
Merge pull request #2047 from peachesontour/patch-5
iliakan Aug 8, 2020
4ff6eb4
Various minor syntax and punctuation changes
paroche Aug 9, 2020
2aab98a
Merge pull request #2050 from javascript-tutorial/paroche-patch-19
paroche Aug 9, 2020
8d13b7f
One more little phrasing change
paroche Aug 9, 2020
1cfd422
minor fixes
iliakan Aug 9, 2020
2bf8a27
minor fixes
iliakan Aug 9, 2020
fbf443e
minor fixes
iliakan Aug 9, 2020
3a924fc
minor fixes
iliakan Aug 10, 2020
bc92283
Update article.md
Aug 13, 2020
6615df4
Update article.md
Aug 13, 2020
665b8eb
Merge pull request #2063 from maksumi/patch-3
iliakan Aug 14, 2020
43ff24e
[Typo Correction] - "fetch" solution typo error
C17AN Aug 14, 2020
9add5e7
Merge pull request #2065 from C17AN/patch-1
iliakan Aug 14, 2020
8eab7d6
minor fixes
iliakan Aug 14, 2020
b0624a1
minor fixes
iliakan Aug 14, 2020
665b972
delete unused line
Violet-Bora-Lee Aug 16, 2020
fe571b3
Merge pull request #2066 from Violet-Bora-Lee/master
iliakan Aug 16, 2020
bc9219b
merging all conflicts
iliakan Aug 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/05-types/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ Mehr über das Arbeiten mit Zahlen erfahren wir in diesem Kapitel <info:number>.

## BigInt

<<<<<<< HEAD
In JavaScript kann der Typ "Zahl" keine ganzzahligen Werte darstellen, die größer als <code>(2<sup>53</sup>-1)</code> (das ist `9007199254740991`) oder kleiner als <code>-(-2<sup>53</sup>-1)</code> für Negative sind. Es handelt sich um eine technische Einschränkung, die durch ihre interne Darstellung bedingt ist.
=======
In JavaScript, the "number" type cannot represent integer values larger than <code>(2<sup>53</sup>-1)</code> (that's `9007199254740991`), or less than <code>-(2<sup>53</sup>-1)</code> for negatives. It's a technical limitation caused by their internal representation.
>>>>>>> fe571b36ed9e225f29239e82947005b08d74ac05

Für die meisten Zwecke reicht das völlig aus, aber manchmal brauchen wir wirklich große Zahlen, z.B. für die Kryptographie oder Zeitstempel mit Mikrosekunden-Genauigkeit.

Expand Down
4 changes: 4 additions & 0 deletions 1-js/02-first-steps/06-alert-prompt-confirm/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ Da wir den Browser als unsere Demo-Umgebung verwenden, wollen wir einige Funktio

## alert

<<<<<<< HEAD
Diese haben wir bereits gesehen. Es zeigt eine Meldung an und wartet darauf, dass der Benutzer "OK" drückt.
=======
This one we've seen already. It shows a message and waits for the user to press "OK".
>>>>>>> fe571b36ed9e225f29239e82947005b08d74ac05

Zum Beispiel:

Expand Down
2 changes: 1 addition & 1 deletion 1-js/02-first-steps/10-ifelse/article.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Conditional operators: if, '?'
# Conditional branching: if, '?'

Sometimes, we need to perform different actions based on different conditions.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Which behavior is better depends on a particular use case. When zero height is a

## Precedence

The precedence of the `??` operator is rather low: `7` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table).
The precedence of the `??` operator is rather low: `5` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table).

So `??` is evaluated after most other operations, but before `=` and `?`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function pow(x,n) // <- no space between arguments

let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
// but better make it 2 lines, also there's no spaces and missing ;
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
if (n<=0) // <- no spaces inside (n <= 0), and should be extra line above it
{ // <- figure bracket on a separate line
// below - long lines can be split into multiple lines for improved readability
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
Expand All @@ -39,7 +39,7 @@ function pow(x, n) {
let x = prompt("x?", "");
let n = prompt("n?", "");

if (n < 0) {
if (n <= 0) {
alert(`Power ${n} is not supported,
please enter an integer number greater than zero`);
} else {
Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/03-garbage-collection/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Simply put, "reachable" values are those that are accessible or usable somehow.

2. Any other value is considered reachable if it's reachable from a root by a reference or by a chain of references.

For instance, if there's an object in a local variable, and that object has a property referencing another object, that object is considered reachable. And those that it references are also reachable. Detailed examples to follow.
For instance, if there's an object in a global variable, and that object has a property referencing another object, that object is considered reachable. And those that it references are also reachable. Detailed examples to follow.

There's a background process in the JavaScript engine that is called [garbage collector](https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)). It monitors all objects and removes those that have become unreachable.

Expand Down
4 changes: 2 additions & 2 deletions 1-js/04-object-basics/08-symbol/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ user.id = "Their id value"
// Boom! overwritten by another script!
```

### Symbols in a literal
### Symbols in an object literal

If we want to use a symbol in an object literal `{...}`, we need square brackets around it.

Expand All @@ -133,7 +133,7 @@ let id = Symbol("id");
let user = {
name: "John",
*!*
[id]: 123 // not "id: 123"
[id]: 123 // not "id": 123
*/!*
};
```
Expand Down
2 changes: 1 addition & 1 deletion 1-js/04-object-basics/09-object-toprimitive/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ There are three variants of type conversion, so-called "hints", described in the
`"default"`
: Occurs in rare cases when the operator is "not sure" what type to expect.

For instance, binary plus `+` can work both with strings (concatenates them) and numbers (adds them), so both strings and numbers would do. So if the a binary plus gets an object as an argument, it uses the `"default"` hint to convert it.
For instance, binary plus `+` can work both with strings (concatenates them) and numbers (adds them), so both strings and numbers would do. So if a binary plus gets an object as an argument, it uses the `"default"` hint to convert it.

Also, if an object is compared using `==` with a string, number or a symbol, it's also unclear which conversion should be done, so the `"default"` hint is used.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function func() {
func();
```

In this example we can observe the peculiar difference between a "non-existing" and "unitialized" variable.
In this example we can observe the peculiar difference between a "non-existing" and "uninitialized" variable.

As you may have read in the article [](info:closure), a variable starts in the "uninitialized" state from the moment when the execution enters a code block (or a function). And it stays uninitalized until the corresponding `let` statement.

Expand Down
12 changes: 8 additions & 4 deletions 1-js/06-advanced-functions/03-closure/article.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

# Variable scope
# Variable scope, closure

JavaScript is a very function-oriented language. It gives us a lot of freedom. A function can be created dynamically, passed as an argument to another function and called from a totally different place of code later.
JavaScript is a very function-oriented language. It gives us a lot of freedom. A function can be created at any moment, passed as an argument to another function, and then called from a totally different place of code later.

We already know that a function can access variables outside of it.
We already know that a function can access variables outside of it ("outer" variables).

Now let's expand our knowledge to include more complex scenarios.
But what happens if outer variables change since a function is created? Will the function get newer values or the old ones?

And what if a function is passed along as a parameter and called from another place of code, will it get access to outer variables at the new place?

Let's expand our knowledge to understand these scenarios and more complex ones.

```smart header="We'll talk about `let/const` variables here"
In JavaScript, there are 3 ways to declare a variable: `let`, `const` (the modern ones), and `var` (the remnant of the past).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ importance: 5

Create a "throttling" decorator `throttle(f, ms)` -- that returns a wrapper.

When it's called multiple times, it passes the call to `f` at maximum once per `ms` milliseconds.
When it's called multiple times, it passes the call to `f` at maximum once per `ms` milliseconds.

The difference with debounce is that it's completely different decorator:
- `debounce` runs the function once after the "cooldown" period. Good for processing the final result.
Expand Down
4 changes: 2 additions & 2 deletions 1-js/06-advanced-functions/10-bind/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ sayHi(); // Hello, John!
setTimeout(sayHi, 1000); // Hello, John!

// even if the value of user changes within 1 second
// sayHi uses the pre-bound value
// sayHi uses the pre-bound value which is reference to the old user object
user = {
sayHi() { alert("Another user in setTimeout!"); }
};
Expand Down Expand Up @@ -202,7 +202,7 @@ for (let key in user) {
}
```

JavaScript libraries also provide functions for convenient mass binding , e.g. [_.bindAll(obj)](http://lodash.com/docs#bindAll) in lodash.
JavaScript libraries also provide functions for convenient mass binding , e.g. [_.bindAll(object, methodNames)](http://lodash.com/docs#bindAll) in lodash.
````

## Partial functions
Expand Down
4 changes: 2 additions & 2 deletions 1-js/08-prototypes/04-prototype-methods/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The `__proto__` is considered outdated and somewhat deprecated (in browser-only

The modern methods are:

- [Object.create(proto[, descriptors])](mdn:js/Object/create) -- creates an empty object with given `proto` as `[[Prototype]]` and optional property descriptors.
- [Object.create(proto, [descriptors])](mdn:js/Object/create) -- creates an empty object with given `proto` as `[[Prototype]]` and optional property descriptors.
- [Object.getPrototypeOf(obj)](mdn:js/Object/getPrototypeOf) -- returns the `[[Prototype]]` of `obj`.
- [Object.setPrototypeOf(obj, proto)](mdn:js/Object/setPrototypeOf) -- sets the `[[Prototype]]` of `obj` to `proto`.

Expand Down Expand Up @@ -175,7 +175,7 @@ alert(Object.keys(chineseDictionary)); // hello,bye

Modern methods to set up and directly access the prototype are:

- [Object.create(proto[, descriptors])](mdn:js/Object/create) -- creates an empty object with a given `proto` as `[[Prototype]]` (can be `null`) and optional property descriptors.
- [Object.create(proto, [descriptors])](mdn:js/Object/create) -- creates an empty object with a given `proto` as `[[Prototype]]` (can be `null`) and optional property descriptors.
- [Object.getPrototypeOf(obj)](mdn:js/Object.getPrototypeOf) -- returns the `[[Prototype]]` of `obj` (same as `__proto__` getter).
- [Object.setPrototypeOf(obj, proto)](mdn:js/Object.setPrototypeOf) -- sets the `[[Prototype]]` of `obj` to `proto` (same as `__proto__` setter).

Expand Down
2 changes: 1 addition & 1 deletion 1-js/09-classes/06-instanceof/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ For most environment-specific objects, there is such a property. Here are some b

```js run
// toStringTag for the environment-specific object and class:
alert( window[Symbol.toStringTag]); // window
alert( window[Symbol.toStringTag]); // Window
alert( XMLHttpRequest.prototype[Symbol.toStringTag] ); // XMLHttpRequest

alert( {}.toString.call(window) ); // [object Window]
Expand Down
2 changes: 1 addition & 1 deletion 1-js/09-classes/07-mixins/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ let eventMixin = {
* this.trigger('select', data1, data2);
*/
trigger(eventName, ...args) {
if (!this._eventHandlers || !this._eventHandlers[eventName]) {
if (!this._eventHandlers?.[eventName]) {
return; // no handlers for that event name
}

Expand Down
2 changes: 1 addition & 1 deletion 1-js/10-error-handling/1-try-catch/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ The "rethrowing" technique can be explained in more detail as:

1. Catch gets all errors.
2. In the `catch(err) {...}` block we analyze the error object `err`.
2. If we don't know how to handle it, we do `throw err`.
3. If we don't know how to handle it, we do `throw err`.

Usually, we can check the error type using the `instanceof` operator:

Expand Down
2 changes: 1 addition & 1 deletion 1-js/11-async/04-promise-error-handling/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Here the `.catch` block finishes normally. So the next successful `.then` handle
In the example below we see the other situation with `.catch`. The handler `(*)` catches the error and just can't handle it (e.g. it only knows how to handle `URIError`), so it throws it again:

```js run
// the execution: catch -> catch -> then
// the execution: catch -> catch
new Promise((resolve, reject) => {

throw new Error("Whoops!");
Expand Down
7 changes: 3 additions & 4 deletions 1-js/11-async/08-async-await/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ f();

The function execution "pauses" at the line `(*)` and resumes when the promise settles, with `result` becoming its result. So the code above shows "done!" in one second.

Let's emphasize: `await` literally makes JavaScript wait until the promise settles, and then go on with the result. That doesn't cost any CPU resources, because the engine can do other jobs in the meantime: execute other scripts, handle events, etc.
Let's emphasize: `await` literally suspends the function execution until the promise settles, and then resumes it with the promise result. That doesn't cost any CPU resources, because the JavaScript engine can do other jobs in the meantime: execute other scripts, handle events, etc.

It's just a more elegant syntax of getting the promise result than `promise.then`, easier to read and write.

Expand All @@ -83,7 +83,7 @@ function f() {
}
```

We will get this error if we do not put `async` before a function. As said, `await` only works inside an `async function`.
We may get this error if we forget to put `async` before a function. As said, `await` only works inside an `async` function.
````

Let's take the `showAvatar()` example from the chapter <info:promise-chaining> and rewrite it using `async/await`:
Expand Down Expand Up @@ -139,9 +139,8 @@ But we can wrap it into an anonymous async function, like this:
...
})();
```


````

````smart header="`await` accepts \"thenables\""
Like `promise.then`, `await` allows us to use thenable objects (those with a callable `then` method). The idea is that a third-party object may not be a promise, but promise-compatible: if it supports `.then`, that's enough to use it with `await`.

Expand Down
6 changes: 3 additions & 3 deletions 1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Error on reading non-existant property
# Error on reading non-existent property

Usually, an attempt to read a non-existant property returns `undefined`.
Usually, an attempt to read a non-existent property returns `undefined`.

Create a proxy that throws an error for an attempt to read of a non-existant property instead.
Create a proxy that throws an error for an attempt to read of a non-existent property instead.

That can help to detect programming mistakes early.

Expand Down
4 changes: 2 additions & 2 deletions 1-js/99-js-misc/01-proxy/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ So there's no such problem when proxying an array.

### Private fields

The similar thing happens with private class fields.
A similar thing happens with private class fields.

For example, `getName()` method accesses the private `#name` property and breaks after proxying:

Expand Down Expand Up @@ -963,7 +963,7 @@ revoke();
alert(proxy.data); // Error
```

A call to `revoke()` removes all internal references to the target object from the proxy, so they are no more connected. The target object can be garbage-collected after that.
A call to `revoke()` removes all internal references to the target object from the proxy, so they are no longer connected. The target object can be garbage-collected after that.

We can also store `revoke` in a `WeakMap`, to be able to easily find it by a proxy object:

Expand Down
6 changes: 0 additions & 6 deletions 1-js/99-js-misc/04-reference-type/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,3 @@ That's for the subsequent method call `()` to get the object and set `this` to i
For all other operations, the reference type automatically becomes the property value (a function in our case).

The whole mechanics is hidden from our eyes. It only matters in subtle cases, such as when a method is obtained dynamically from the object, using an expression.





result of dot `.` isn't actually a method, but a value of `` needs a way to pass the information about `obj`
2 changes: 1 addition & 1 deletion 1-js/99-js-misc/05-bigint/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The conversion operations are always silent, never give errors, but if the bigin
````smart header="The unary plus is not supported on bigints"
The unary plus operator `+value` is a well-known way to convert `value` to a number.

On bigints it's not supported, to avoid confusion:
In order to avoid confusion, it's not supported on bigints:
```js run
let bigint = 1n;

Expand Down
2 changes: 1 addition & 1 deletion 2-ui/1-document/07-modifying-document/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ let div = document.createElement('div');
// 2. Set its class to "alert"
div.className = "alert";

// Fill it with the content
// 3. Fill it with the content
div.innerHTML = "<strong>Hi there!</strong> You've read an important message.";
```

Expand Down
4 changes: 2 additions & 2 deletions 2-ui/1-document/11-coordinates/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ As you can see, `left/top` do not equal `x/y` in such case.
In practice though, `elem.getBoundingClientRect()` always returns positive width/height, here we mention negative `width/height` only for you to understand why these seemingly duplicate properties are not actually duplicates.
```

```warn header="Internet Explorer and Edge: no support for `x/y`"
Internet Explorer and Edge don't support `x/y` properties for historical reasons.
```warn header="Internet Explorer: no support for `x/y`"
Internet Explorer doesn't support `x/y` properties for historical reasons.

So we can either make a polyfill (add getters in `DomRect.prototype`) or just use `top/left`, as they are always the same as `x/y` for positive `width/height`, in particular in the result of `elem.getBoundingClientRect()`.
```
Expand Down
2 changes: 1 addition & 1 deletion 2-ui/2-events/01-introduction-browser-events/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ element.removeEventListener(event, handler, [options]);
````warn header="Removal requires the same function"
To remove a handler we should pass exactly the same function as was assigned.

That doesn't work:
This doesn't work:

```js no-beautify
elem.addEventListener( "click" , () => alert('Thanks!'));
Expand Down
2 changes: 1 addition & 1 deletion 2-ui/2-events/05-dispatch-events/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Besides, the event class describes "what kind of event" it is, and if the event

## event.preventDefault()

Many browser events have a "default action", such as nagivating to a link, starting a selection, and so on.
Many browser events have a "default action", such as navigating to a link, starting a selection, and so on.

For new, custom events, there are definitely no default browser actions, but a code that dispatches such event may have its own plans what to do after triggering the event.

Expand Down
6 changes: 3 additions & 3 deletions 2-ui/3-event-details/1-mouse-events-basics/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ We've already seen some of these events:
: Triggers after two clicks on the same element within a short timeframe. Rarely used nowadays.

`contextmenu`
: Triggers when when the right mouse button is pressed. There are other ways to open a context menu, e.g. using a special keyboard key, it triggers in that case also, so it's not exactly the mouse event.
: Triggers when the right mouse button is pressed. There are other ways to open a context menu, e.g. using a special keyboard key, it triggers in that case also, so it's not exactly the mouse event.

...There are several other events too, we'll cover them later.

Expand All @@ -34,7 +34,7 @@ As you can see from the list above, a user action may trigger multiple events.

For instance, a left-button click first triggers `mousedown`, when the button is pressed, then `mouseup` and `click` when it's released.

In cases when a single action initiates multiple events, their order is fixed. That is, the handlers are called in the order `mousedown` -> `mouseup` -> `click`.
In cases when a single action initiates multiple events, their order is fixed. That is, the handlers are called in the order `mousedown` -> `mouseup` -> `click`.

```online
Click the button below and you'll see the events. Try double-click too.
Expand All @@ -50,7 +50,7 @@ Also we can see the `button` property that allows to detect the mouse button, it

Click-related events always have the `button` property, which allows to get the exact mouse button.

We usually don't use it for `click` and `contextmenu` events, because the former happens only on left-click, and the latter -- only on right-click.
We usually don't use it for `click` and `contextmenu` events, because the former happens only on left-click, and the latter -- only on right-click.

From the other hand, `mousedown` and `mouseup` handlers we may need `event.button`, because these events trigger on any button, so `button` allows to distinguish between "right-mousedown" and "left-mousedown".

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


<script>
ball.onmousedown = function(event) {
ball.onmousedown = function(event) {
ball.style.position = 'absolute';
ball.style.zIndex = 1000;
document.body.appendChild(ball);
Expand Down
Loading