From edfe300d8094ef7e9f39b05094cf3301e8df2ec3 Mon Sep 17 00:00:00 2001 From: Roman Romanenko Date: Tue, 23 Jun 2020 17:47:41 +0300 Subject: [PATCH 01/58] Update article.md Fixing a typo --- 1-js/04-object-basics/09-object-toprimitive/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/04-object-basics/09-object-toprimitive/article.md b/1-js/04-object-basics/09-object-toprimitive/article.md index f6b715ce5..36b6c6460 100644 --- a/1-js/04-object-basics/09-object-toprimitive/article.md +++ b/1-js/04-object-basics/09-object-toprimitive/article.md @@ -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. From 4044b7538116330654c91096e79948bd1feba88c Mon Sep 17 00:00:00 2001 From: Dmitriy Davydov Date: Sat, 27 Jun 2020 10:01:42 +0500 Subject: [PATCH 02/58] Fix typo without -> with --- 5-network/05-fetch-crossorigin/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5-network/05-fetch-crossorigin/article.md b/5-network/05-fetch-crossorigin/article.md index 36c57aed4..31fb0b8be 100644 --- a/5-network/05-fetch-crossorigin/article.md +++ b/5-network/05-fetch-crossorigin/article.md @@ -329,7 +329,7 @@ fetch('http://another.com', { }); ``` -Now `fetch` sends cookies originating from `another.com` without request to that site. +Now `fetch` sends cookies originating from `another.com` with request to that site. If the server agrees to accept the request *with credentials*, it should add a header `Access-Control-Allow-Credentials: true` to the response, in addition to `Access-Control-Allow-Origin`. From 97a12c4d9698910219b90c097e1c83148164ab0c Mon Sep 17 00:00:00 2001 From: Akshay Mittal Date: Sat, 27 Jun 2020 23:46:46 +0530 Subject: [PATCH 03/58] Update article.md minor type fixes --- 1-js/08-prototypes/04-prototype-methods/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/08-prototypes/04-prototype-methods/article.md b/1-js/08-prototypes/04-prototype-methods/article.md index d517e1564..71dcb74bb 100644 --- a/1-js/08-prototypes/04-prototype-methods/article.md +++ b/1-js/08-prototypes/04-prototype-methods/article.md @@ -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`. From 1b1b07edac7583ff645bdfedc16a46602ed8397f Mon Sep 17 00:00:00 2001 From: Akshay Mittal Date: Sun, 28 Jun 2020 00:24:10 +0530 Subject: [PATCH 04/58] Update article.md minor typo fix --- 1-js/08-prototypes/04-prototype-methods/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/08-prototypes/04-prototype-methods/article.md b/1-js/08-prototypes/04-prototype-methods/article.md index d517e1564..9a04c17d8 100644 --- a/1-js/08-prototypes/04-prototype-methods/article.md +++ b/1-js/08-prototypes/04-prototype-methods/article.md @@ -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). From 41a1b9291943fe438c771d925fc0e479e4f8ee00 Mon Sep 17 00:00:00 2001 From: traxium Date: Sun, 28 Jun 2020 12:46:59 +0700 Subject: [PATCH 05/58] Fix typo in /instanceof section (widow -> Window) --- 1-js/09-classes/06-instanceof/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/09-classes/06-instanceof/article.md b/1-js/09-classes/06-instanceof/article.md index aa973da06..dd3d61ca6 100644 --- a/1-js/09-classes/06-instanceof/article.md +++ b/1-js/09-classes/06-instanceof/article.md @@ -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] From 01e584fc815017bec3842c642e1a93ee5f13658d Mon Sep 17 00:00:00 2001 From: DanGhanbari <40830705+DanGhanbari@users.noreply.github.com> Date: Sun, 28 Jun 2020 23:30:03 +0100 Subject: [PATCH 06/58] update solution.md There are some missing "=" sign according to the question. --- .../02-coding-style/1-style-errors/solution.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/03-code-quality/02-coding-style/1-style-errors/solution.md b/1-js/03-code-quality/02-coding-style/1-style-errors/solution.md index 764e36c63..4facc8b29 100644 --- a/1-js/03-code-quality/02-coding-style/1-style-errors/solution.md +++ b/1-js/03-code-quality/02-coding-style/1-style-errors/solution.md @@ -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`); @@ -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 { From 74caa865f3ce93ea3e4899e1c27cbfa5c31d1634 Mon Sep 17 00:00:00 2001 From: peachesontour <67612358+peachesontour@users.noreply.github.com> Date: Mon, 29 Jun 2020 21:22:47 -0300 Subject: [PATCH 07/58] Typos 2 small fixes --- 1-js/99-js-misc/01-proxy/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/99-js-misc/01-proxy/article.md b/1-js/99-js-misc/01-proxy/article.md index a4aec1fe5..3f7ef63b8 100644 --- a/1-js/99-js-misc/01-proxy/article.md +++ b/1-js/99-js-misc/01-proxy/article.md @@ -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: @@ -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: From de2542378fc8e23a0e59ebb1ed820fc511c277d5 Mon Sep 17 00:00:00 2001 From: peachesontour <67612358+peachesontour@users.noreply.github.com> Date: Mon, 29 Jun 2020 21:26:07 -0300 Subject: [PATCH 08/58] Typos --- 1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md b/1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md index 827cf35e3..d7093c0c3 100644 --- a/1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md +++ b/1-js/99-js-misc/01-proxy/01-error-nonexisting/task.md @@ -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. From 3e2309cb9b91356a064eae0d34a77d305aaed8ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BA=8C=E7=94=B7?= Date: Wed, 1 Jul 2020 14:37:59 +0800 Subject: [PATCH 09/58] Update article.md --- 1-js/04-object-basics/03-garbage-collection/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/04-object-basics/03-garbage-collection/article.md b/1-js/04-object-basics/03-garbage-collection/article.md index 672e26d43..e20e5a5d8 100644 --- a/1-js/04-object-basics/03-garbage-collection/article.md +++ b/1-js/04-object-basics/03-garbage-collection/article.md @@ -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. From ad0dd99b622949724e7ad73db14af8abd4a9e664 Mon Sep 17 00:00:00 2001 From: Mustafa Kemal Tuna <12192118+lumosmind@users.noreply.github.com> Date: Wed, 1 Jul 2020 18:19:32 +0300 Subject: [PATCH 10/58] is 'if' operator? The title makes me ask "is 'if' keyword operator or not?". I think 'if' is not operator because it does not return any value and it is called if-statement. --- 1-js/02-first-steps/10-ifelse/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/10-ifelse/article.md b/1-js/02-first-steps/10-ifelse/article.md index 30287ccba..7327243b1 100644 --- a/1-js/02-first-steps/10-ifelse/article.md +++ b/1-js/02-first-steps/10-ifelse/article.md @@ -1,4 +1,4 @@ -# Conditional operators: if, '?' +# Conditional branching: if, '?' Sometimes, we need to perform different actions based on different conditions. From 3eb13d5ef88e7e75730491a4871b223d550f04bc Mon Sep 17 00:00:00 2001 From: Dratzidis Athanasios Date: Thu, 2 Jul 2020 05:55:23 +0300 Subject: [PATCH 11/58] Corrected a typo --- 1-js/02-first-steps/06-alert-prompt-confirm/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/06-alert-prompt-confirm/article.md b/1-js/02-first-steps/06-alert-prompt-confirm/article.md index 25bf72482..73b183e52 100644 --- a/1-js/02-first-steps/06-alert-prompt-confirm/article.md +++ b/1-js/02-first-steps/06-alert-prompt-confirm/article.md @@ -4,7 +4,7 @@ As we'll be using the browser as our demo environment, let's see a couple of fun ## alert -This one we've seen already. It shows a message and waits for the user to presses "OK". +This one we've seen already. It shows a message and waits for the user to press "OK". For example: From eb49cb934557cf2500532e9bcdec1ae6db53b098 Mon Sep 17 00:00:00 2001 From: Pushpender <46690325+pushpend3r@users.noreply.github.com> Date: Thu, 2 Jul 2020 23:18:39 +0530 Subject: [PATCH 12/58] Type mistake Used "unitialized" instead of "uninitialized" --- 1-js/06-advanced-functions/03-closure/7-let-scope/solution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/06-advanced-functions/03-closure/7-let-scope/solution.md b/1-js/06-advanced-functions/03-closure/7-let-scope/solution.md index 404bae80b..346e4060a 100644 --- a/1-js/06-advanced-functions/03-closure/7-let-scope/solution.md +++ b/1-js/06-advanced-functions/03-closure/7-let-scope/solution.md @@ -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. From f0dbc65f5370157ac1131ded5b49770a2b9bbebd Mon Sep 17 00:00:00 2001 From: Siddharth Golchha Date: Fri, 3 Jul 2020 18:53:01 -0700 Subject: [PATCH 13/58] Fixed Type --- 2-ui/2-events/05-dispatch-events/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/2-events/05-dispatch-events/article.md b/2-ui/2-events/05-dispatch-events/article.md index 1a8e92ef1..e667bf741 100644 --- a/2-ui/2-events/05-dispatch-events/article.md +++ b/2-ui/2-events/05-dispatch-events/article.md @@ -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. From 5ac51835a7f91f993f1dd50e78bcd6823f5c68ed Mon Sep 17 00:00:00 2001 From: Mustafa Kemal Tuna <12192118+lumosmind@users.noreply.github.com> Date: Sat, 4 Jul 2020 18:34:34 +0300 Subject: [PATCH 14/58] more definitive title There are also array literals and string literals. --- 1-js/04-object-basics/08-symbol/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/04-object-basics/08-symbol/article.md b/1-js/04-object-basics/08-symbol/article.md index 1ed73ed4b..8825395f5 100644 --- a/1-js/04-object-basics/08-symbol/article.md +++ b/1-js/04-object-basics/08-symbol/article.md @@ -121,7 +121,7 @@ user.id = "Their id value" // Boom! overwritten by another script! ``` -### Symbols in a literal +### Symbols in a object literal If we want to use a symbol in an object literal `{...}`, we need square brackets around it. From d9ab352ed857ba5781b8d2ecb8ff1b54cb39fffa Mon Sep 17 00:00:00 2001 From: Shubham Maurya Date: Sun, 5 Jul 2020 23:18:37 +0530 Subject: [PATCH 15/58] Update article.md Minor edit around example code: " should be around id --- 1-js/04-object-basics/08-symbol/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/04-object-basics/08-symbol/article.md b/1-js/04-object-basics/08-symbol/article.md index 1ed73ed4b..f09769277 100644 --- a/1-js/04-object-basics/08-symbol/article.md +++ b/1-js/04-object-basics/08-symbol/article.md @@ -133,7 +133,7 @@ let id = Symbol("id"); let user = { name: "John", *!* - [id]: 123 // not "id: 123" + [id]: 123 // not "id": 123 */!* }; ``` From 8a9f4405475d2f3f05319937599be4cb9a45f55b Mon Sep 17 00:00:00 2001 From: LeviDing Date: Mon, 6 Jul 2020 15:17:06 +0800 Subject: [PATCH 16/58] Fix error of BigInt --- 1-js/02-first-steps/05-types/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index c4a67e83f..ab8094f1d 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -66,7 +66,7 @@ We'll see more about working with numbers in the chapter . ## BigInt -In JavaScript, the "number" type cannot represent integer values larger than (253-1) (that's `9007199254740991`), or less than -(-253-1) for negatives. It's a technical limitation caused by their internal representation. +In JavaScript, the "number" type cannot represent integer values larger than (253-1) (that's `9007199254740991`), or less than -(253-1) for negatives. It's a technical limitation caused by their internal representation. For most purposes that's quite enough, but sometimes we need really big numbers, e.g. for cryptography or microsecond-precision timestamps. From 1ad3c2c339c210aab44786c5f8d0eac449b95332 Mon Sep 17 00:00:00 2001 From: Sergei Makhlonov <38110833+smakhl@users.noreply.github.com> Date: Tue, 7 Jul 2020 13:02:50 +0300 Subject: [PATCH 17/58] Correct message in sandbox.view iframe --- .../03-cross-window-communication/sandbox.view/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html b/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html index 478830610..46dd7b5cc 100644 --- a/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html +++ b/3-frames-and-windows/03-cross-window-communication/sandbox.view/index.html @@ -7,7 +7,7 @@ -
The iframe below is has sandbox attribute.
+
The iframe below has the sandbox attribute.
From 23fb044973806472b3e6023a78ddbac1aa860fc4 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Tue, 7 Jul 2020 20:18:26 +0800 Subject: [PATCH 18/58] Update task.md --- .../09-call-apply-decorators/04-throttle/task.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md b/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md index 6cb664fdb..0ab09e640 100644 --- a/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md +++ b/1-js/06-advanced-functions/09-call-apply-decorators/04-throttle/task.md @@ -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. From 9e3065f6ae0567134dc4859950884e9ac12a6d3f Mon Sep 17 00:00:00 2001 From: Chao Zhang Date: Thu, 9 Jul 2020 15:48:36 -0400 Subject: [PATCH 19/58] Fix a comment --- 1-js/11-async/04-promise-error-handling/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/11-async/04-promise-error-handling/article.md b/1-js/11-async/04-promise-error-handling/article.md index 7c6af6a33..9f7159af9 100644 --- a/1-js/11-async/04-promise-error-handling/article.md +++ b/1-js/11-async/04-promise-error-handling/article.md @@ -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!"); From 38526232a6f8a9b33ae321654ffccb629a3b0f16 Mon Sep 17 00:00:00 2001 From: Dalibor Pasalic Date: Fri, 10 Jul 2020 08:32:18 +0200 Subject: [PATCH 20/58] 8.4 Prototype methods... - Fix code typo Move comma before square bracket Object.create(proto[, descriptors]) --- 1-js/08-prototypes/04-prototype-methods/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/08-prototypes/04-prototype-methods/article.md b/1-js/08-prototypes/04-prototype-methods/article.md index d517e1564..71dcb74bb 100644 --- a/1-js/08-prototypes/04-prototype-methods/article.md +++ b/1-js/08-prototypes/04-prototype-methods/article.md @@ -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`. From 15214dce44a1e568cb978aea874ab22930d96864 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20=C4=90=E1=BB=A9c=20H=C3=A0o?= <39975444+haond10adp@users.noreply.github.com> Date: Fri, 10 Jul 2020 15:16:20 +0700 Subject: [PATCH 21/58] Update article.md --- 5-network/07-url/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5-network/07-url/article.md b/5-network/07-url/article.md index 591a55af2..c41400451 100644 --- a/5-network/07-url/article.md +++ b/5-network/07-url/article.md @@ -88,7 +88,7 @@ It provides convenient methods for search parameters: - **`delete(name)`** -- remove the parameter by `name`, - **`get(name)`** -- get the parameter by `name`, - **`getAll(name)`** -- get all parameters with the same `name` (that's possible, e.g. `?user=John&user=Pete`), -- **`has(name)`** -- check for the existance of the parameter by `name`, +- **`has(name)`** -- check for the existence of the parameter by `name`, - **`set(name, value)`** -- set/replace the parameter, - **`sort()`** -- sort parameters by name, rarely needed, - ...and it's also iterable, similar to `Map`. From 56edf4ac5b915d09c10dc0011f2eb04a743feb18 Mon Sep 17 00:00:00 2001 From: Mazhar Zandsalimi Date: Sat, 11 Jul 2020 13:27:49 +0430 Subject: [PATCH 22/58] minor fix: precedence is 5 according to MDN --- 1-js/02-first-steps/12-nullish-coalescing-operator/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/12-nullish-coalescing-operator/article.md b/1-js/02-first-steps/12-nullish-coalescing-operator/article.md index f0f6687a3..c72dd91d6 100644 --- a/1-js/02-first-steps/12-nullish-coalescing-operator/article.md +++ b/1-js/02-first-steps/12-nullish-coalescing-operator/article.md @@ -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 `?`. From 72482bc4358c2f4ac3c1860235194d023f11d312 Mon Sep 17 00:00:00 2001 From: Peter Roche <46547072+paroche@users.noreply.github.com> Date: Thu, 16 Jul 2020 10:20:25 -0600 Subject: [PATCH 23/58] Update article.md Revision to unary plus not allowed bigints description in response to PR --- 1-js/99-js-misc/05-bigint/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/99-js-misc/05-bigint/article.md b/1-js/99-js-misc/05-bigint/article.md index 72f06d0c7..062dd6017 100644 --- a/1-js/99-js-misc/05-bigint/article.md +++ b/1-js/99-js-misc/05-bigint/article.md @@ -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; From de13fafd1b9dd7bfecc552b799ed863ffb4761bb Mon Sep 17 00:00:00 2001 From: LeviDing Date: Fri, 17 Jul 2020 14:11:01 +0800 Subject: [PATCH 24/58] Update bindAll of lodash --- 1-js/06-advanced-functions/10-bind/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/06-advanced-functions/10-bind/article.md b/1-js/06-advanced-functions/10-bind/article.md index 787c7d68e..364146fdb 100644 --- a/1-js/06-advanced-functions/10-bind/article.md +++ b/1-js/06-advanced-functions/10-bind/article.md @@ -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 From 0b7266da47700436842bc0c956f11c6ed54db7a7 Mon Sep 17 00:00:00 2001 From: Pankaj Tanwar <2016ucp1381@mnit.ac.in> Date: Fri, 17 Jul 2020 21:40:25 +0530 Subject: [PATCH 25/58] Browser LocalStorage capacity updated to 5 MB. --- 6-data-storage/02-localstorage/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/6-data-storage/02-localstorage/article.md b/6-data-storage/02-localstorage/article.md index 3ba9aa972..d5d0bbdc6 100644 --- a/6-data-storage/02-localstorage/article.md +++ b/6-data-storage/02-localstorage/article.md @@ -222,7 +222,7 @@ Modern browsers also support [Broadcast channel API](https://developer.mozilla.o Web storage objects `localStorage` and `sessionStorage` allow to store key/value in the browser. - Both `key` and `value` must be strings. -- The limit is 2mb+, depends on the browser. +- The limit is 5mb+, depends on the browser. - They do not expire. - The data is bound to the origin (domain/port/protocol). From dfcacf2d82b4ae7b4a259c50fa497e1090f84095 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Sat, 18 Jul 2020 12:16:23 +0800 Subject: [PATCH 26/58] Fix minor typo error: ol number --- 1-js/10-error-handling/1-try-catch/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/10-error-handling/1-try-catch/article.md b/1-js/10-error-handling/1-try-catch/article.md index 7d41b71b1..3a2dc4ed4 100644 --- a/1-js/10-error-handling/1-try-catch/article.md +++ b/1-js/10-error-handling/1-try-catch/article.md @@ -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: From 7480a24c2539291c7895bb6b39247508c7770e0b Mon Sep 17 00:00:00 2001 From: LeviDing Date: Sat, 18 Jul 2020 13:17:18 +0800 Subject: [PATCH 27/58] Fix minor typo error: add ol number --- 2-ui/1-document/07-modifying-document/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/1-document/07-modifying-document/article.md b/2-ui/1-document/07-modifying-document/article.md index 9a2677df4..75ce1fbb0 100644 --- a/2-ui/1-document/07-modifying-document/article.md +++ b/2-ui/1-document/07-modifying-document/article.md @@ -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 = "Hi there! You've read an important message."; ``` From 356d5278cdd8309dce0871d40d00b54d90dd4c33 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Sat, 18 Jul 2020 15:38:36 +0800 Subject: [PATCH 28/58] Fix minor typo error: change when when to when --- 2-ui/3-event-details/1-mouse-events-basics/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/1-mouse-events-basics/article.md b/2-ui/3-event-details/1-mouse-events-basics/article.md index 551bc564a..292cae95d 100644 --- a/2-ui/3-event-details/1-mouse-events-basics/article.md +++ b/2-ui/3-event-details/1-mouse-events-basics/article.md @@ -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. From 0d497c7b34c473839764728bdbfd121fac7811ad Mon Sep 17 00:00:00 2001 From: LeviDing Date: Sat, 18 Jul 2020 15:55:54 +0800 Subject: [PATCH 29/58] Update article.md --- 2-ui/3-event-details/1-mouse-events-basics/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/1-mouse-events-basics/article.md b/2-ui/3-event-details/1-mouse-events-basics/article.md index 292cae95d..3856bf0e2 100644 --- a/2-ui/3-event-details/1-mouse-events-basics/article.md +++ b/2-ui/3-event-details/1-mouse-events-basics/article.md @@ -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. From d0474aea6fee693b19f1350ea5f67a08be059b4e Mon Sep 17 00:00:00 2001 From: LeviDing Date: Sat, 18 Jul 2020 16:12:22 +0800 Subject: [PATCH 30/58] Update article.md --- 2-ui/3-event-details/1-mouse-events-basics/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/1-mouse-events-basics/article.md b/2-ui/3-event-details/1-mouse-events-basics/article.md index 3856bf0e2..b5535bea5 100644 --- a/2-ui/3-event-details/1-mouse-events-basics/article.md +++ b/2-ui/3-event-details/1-mouse-events-basics/article.md @@ -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". From 6800c2ac4b0e2b90390f7f192f5e674a7ac0f142 Mon Sep 17 00:00:00 2001 From: LeviDing Date: Sat, 18 Jul 2020 16:51:56 +0800 Subject: [PATCH 31/58] Update index.html --- 2-ui/3-event-details/4-mouse-drag-and-drop/ball.view/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/4-mouse-drag-and-drop/ball.view/index.html b/2-ui/3-event-details/4-mouse-drag-and-drop/ball.view/index.html index 36219e303..8751c70ad 100644 --- a/2-ui/3-event-details/4-mouse-drag-and-drop/ball.view/index.html +++ b/2-ui/3-event-details/4-mouse-drag-and-drop/ball.view/index.html @@ -13,7 +13,7 @@