From ffcb5da587fc378f47ade5d5e3bc13d151133e5c Mon Sep 17 00:00:00 2001 From: jonathanlu31 <42872531+jonathanlu31@users.noreply.github.com> Date: Wed, 2 Jun 2021 11:11:48 -0700 Subject: [PATCH 01/18] Fix grammar --- 2-ui/2-events/04-default-browser-action/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2-ui/2-events/04-default-browser-action/article.md b/2-ui/2-events/04-default-browser-action/article.md index ceac160c1..cd815654f 100644 --- a/2-ui/2-events/04-default-browser-action/article.md +++ b/2-ui/2-events/04-default-browser-action/article.md @@ -17,7 +17,7 @@ There are two ways to tell the browser we don't want it to act: - The main way is to use the `event` object. There's a method `event.preventDefault()`. - If the handler is assigned using `on` (not by `addEventListener`), then returning `false` also works the same. -In this HTML a click on a link doesn't lead to navigation, browser doesn't do anything: +In this HTML, a click on a link doesn't lead to navigation; the browser doesn't do anything: ```html autorun height=60 no-beautify Click here @@ -96,7 +96,7 @@ That's because the browser action is canceled on `mousedown`. The focusing is st The optional `passive: true` option of `addEventListener` signals the browser that the handler is not going to call `preventDefault()`. -Why that may be needed? +Why might that be needed? There are some events like `touchmove` on mobile devices (when the user moves their finger across the screen), that cause scrolling by default, but that scrolling can be prevented using `preventDefault()` in the handler. From 8f039d3806a30ee0691d2c14d43988551d72fe16 Mon Sep 17 00:00:00 2001 From: jonathanlu31 <42872531+jonathanlu31@users.noreply.github.com> Date: Wed, 2 Jun 2021 11:32:08 -0700 Subject: [PATCH 02/18] Fix grammar and typos in mouse events basics --- 2-ui/3-event-details/1-mouse-events-basics/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 4f3be1933..ad12f25aa 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 @@ -39,9 +39,9 @@ In cases when a single action initiates multiple events, their order is fixed. T ```online Click the button below and you'll see the events. Try double-click too. -On the teststand below all mouse events are logged, and if there is more than a 1 second delay between them they are separated by a horizontal ruler. +In the tests and below, all mouse events are logged, and if there is more than a 1 second delay between them, they are separated by a horizontal rule. -Also we can see the `button` property that allows to detect the mouse button, it's explained below. +Also, we can see the `button` property that allows us to detect the mouse button; it's explained below.
``` From 0786cfac090250a976da032b27e3bbea540b9552 Mon Sep 17 00:00:00 2001 From: jonathanlu31 <42872531+jonathanlu31@users.noreply.github.com> Date: Mon, 14 Jun 2021 13:27:08 -0700 Subject: [PATCH 03/18] Change back miscorrected typo --- 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 ad12f25aa..c322126e4 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 @@ -39,7 +39,7 @@ In cases when a single action initiates multiple events, their order is fixed. T ```online Click the button below and you'll see the events. Try double-click too. -In the tests and below, all mouse events are logged, and if there is more than a 1 second delay between them, they are separated by a horizontal rule. +On the teststand below, all mouse events are logged, and if there is more than a 1 second delay between them, they are separated by a horizontal rule. Also, we can see the `button` property that allows us to detect the mouse button; it's explained below. From 727d314238410b8bbcdb2626a1d6d9038690001f Mon Sep 17 00:00:00 2001 From: jonathanlu31 <42872531+jonathanlu31@users.noreply.github.com> Date: Mon, 14 Jun 2021 13:42:59 -0700 Subject: [PATCH 04/18] Minor changes in grammar and word choice --- 1-js/11-async/01-callbacks/article.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/1-js/11-async/01-callbacks/article.md b/1-js/11-async/01-callbacks/article.md index 344d92b74..a5d843b4a 100644 --- a/1-js/11-async/01-callbacks/article.md +++ b/1-js/11-async/01-callbacks/article.md @@ -196,9 +196,9 @@ So the single `callback` function is used both for reporting errors and passing ## Pyramid of Doom -From the first look, it's a viable way of asynchronous coding. And indeed it is. For one or maybe two nested calls it looks fine. +At first glance, it looks like a viable approach to asynchronous coding. And indeed it is. For one or maybe two nested calls it looks fine. -But for multiple asynchronous actions that follow one after another we'll have code like this: +But for multiple asynchronous actions that follow one after another, we'll have code like this: ```js loadScript('1.js', function(error, script) { @@ -229,8 +229,8 @@ loadScript('1.js', function(error, script) { ``` In the code above: -1. We load `1.js`, then if there's no error. -2. We load `2.js`, then if there's no error. +1. We load `1.js`, then if there's no error... +2. We load `2.js`, then if there's no error... 3. We load `3.js`, then if there's no error -- do something else `(*)`. As calls become more nested, the code becomes deeper and increasingly more difficult to manage, especially if we have real code instead of `...` that may include more loops, conditional statements and so on. @@ -299,7 +299,7 @@ function step3(error, script) { } ``` -See? It does the same, and there's no deep nesting now because we made every action a separate top-level function. +See? It does the same thing, and there's no deep nesting now because we made every action a separate top-level function. It works, but the code looks like a torn apart spreadsheet. It's difficult to read, and you probably noticed that one needs to eye-jump between pieces while reading it. That's inconvenient, especially if the reader is not familiar with the code and doesn't know where to eye-jump. From 5af71a9dee62f904f31187321834002e1b9c5a39 Mon Sep 17 00:00:00 2001 From: Kenneth Lum Date: Sat, 23 Oct 2021 15:46:39 -0700 Subject: [PATCH 05/18] fix sentence --- 1-js/04-object-basics/07-optional-chaining/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/04-object-basics/07-optional-chaining/article.md b/1-js/04-object-basics/07-optional-chaining/article.md index 9591dcd6c..f27f7d1d2 100644 --- a/1-js/04-object-basics/07-optional-chaining/article.md +++ b/1-js/04-object-basics/07-optional-chaining/article.md @@ -25,7 +25,7 @@ That's the expected result. JavaScript works like this. As `user.address` is `un In many practical cases we'd prefer to get `undefined` instead of an error here (meaning "no street"). -...And another example. In the web development, we can get an object that corresponds to a web page element using a special method call, such as `document.querySelector('.elem')`, and it returns `null` when there's no such element. +...and another example. In Web development, we can get an object that corresponds to a web page element using a special method call, such as `document.querySelector('.elem')`, and it returns `null` when there's no such element. ```js run // document.querySelector('.elem') is null if there's no element From 180cb4406def9ef67a76c061c4921730dcae4345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=83=82=E6=9F=AF=E4=BA=BA?= <57043221+Lankerened@users.noreply.github.com> Date: Mon, 3 Jan 2022 10:59:48 +0800 Subject: [PATCH 06/18] Update article.md FIX: fix bug caused by GitHub data change --- .../2-async-iterators-generators/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/12-generators-iterators/2-async-iterators-generators/article.md b/1-js/12-generators-iterators/2-async-iterators-generators/article.md index d4e9f7861..87d125be8 100644 --- a/1-js/12-generators-iterators/2-async-iterators-generators/article.md +++ b/1-js/12-generators-iterators/2-async-iterators-generators/article.md @@ -376,7 +376,7 @@ An example of use (shows commit authors in console): for await (const commit of fetchCommits('javascript-tutorial/en.javascript.info')) { - console.log(commit.author.login); + console.log(commit.author.name); if (++count == 100) { // let's stop at 100 commits break; From 3cf22123be6ad95e135f06f422d2224567756839 Mon Sep 17 00:00:00 2001 From: Kartik <74047447+kk-source@users.noreply.github.com> Date: Fri, 7 Jan 2022 23:43:14 +0530 Subject: [PATCH 07/18] Update article.md Added missing word in a sentence. --- 1-js/05-data-types/10-destructuring-assignment/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/05-data-types/10-destructuring-assignment/article.md b/1-js/05-data-types/10-destructuring-assignment/article.md index fb9346aa2..98c7f73d2 100644 --- a/1-js/05-data-types/10-destructuring-assignment/article.md +++ b/1-js/05-data-types/10-destructuring-assignment/article.md @@ -5,7 +5,7 @@ The two most used data structures in JavaScript are `Object` and `Array`. - Objects allow us to create a single entity that stores data items by key. - Arrays allow us to gather data items into an ordered list. -Although, when we pass those to a function, it may need not an object/array as a whole. It may need individual pieces. +Although, when we pass those to a function, it may need not be an object/array as a whole. It may need individual pieces. *Destructuring assignment* is a special syntax that allows us to "unpack" arrays or objects into a bunch of variables, as sometimes that's more convenient. From ecbb2b837988a20f1e8e9f33cb045abf6ff0189a Mon Sep 17 00:00:00 2001 From: joaquinelio Date: Sat, 8 Jan 2022 19:55:36 -0300 Subject: [PATCH 08/18] redundant --- 2-ui/3-event-details/7-keyboard-events/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/7-keyboard-events/article.md b/2-ui/3-event-details/7-keyboard-events/article.md index 51c1618f6..86e9b83fd 100644 --- a/2-ui/3-event-details/7-keyboard-events/article.md +++ b/2-ui/3-event-details/7-keyboard-events/article.md @@ -107,7 +107,7 @@ So, `event.code` may match a wrong character for unexpected layout. Same letters To reliably track layout-dependent characters, `event.key` may be a better way. -On the other hand, `event.code` has the benefit of staying always the same, bound to the physical key location, even if the visitor changes languages. So hotkeys that rely on it work well even in case of a language switch. +On the other hand, `event.code` has the benefit of staying always the same, bound to the physical key location. So hotkeys that rely on it work well even in case of a language switch. Do we want to handle layout-dependant keys? Then `event.key` is the way to go. From 435265ee9d5c33f8c98a5c28ff1d3b3b33213953 Mon Sep 17 00:00:00 2001 From: joaquinelio Date: Sun, 9 Jan 2022 19:03:42 -0300 Subject: [PATCH 09/18] Update article.md --- 2-ui/3-event-details/7-keyboard-events/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/7-keyboard-events/article.md b/2-ui/3-event-details/7-keyboard-events/article.md index 86e9b83fd..7cb1c47ca 100644 --- a/2-ui/3-event-details/7-keyboard-events/article.md +++ b/2-ui/3-event-details/7-keyboard-events/article.md @@ -107,7 +107,7 @@ So, `event.code` may match a wrong character for unexpected layout. Same letters To reliably track layout-dependent characters, `event.key` may be a better way. -On the other hand, `event.code` has the benefit of staying always the same, bound to the physical key location. So hotkeys that rely on it work well even in case of a language switch. +On the other hand, `event.code` has the benefit of staying always the same, bound to the physical key location. So hotkeys that rely on it work well even in case of a language switch. For example, games that use `key:A` `key:D` for an avatar traveling. Do we want to handle layout-dependant keys? Then `event.key` is the way to go. From a960e3e753180b0f52dc5496c584a9ea12263578 Mon Sep 17 00:00:00 2001 From: chrisbarbas Date: Thu, 13 Jan 2022 04:04:27 -0500 Subject: [PATCH 10/18] Added 'the' to first sentence Capturing and bubbling allow us to implement one of [the] most powerful event handling patterns --- 2-ui/2-events/03-event-delegation/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/2-events/03-event-delegation/article.md b/2-ui/2-events/03-event-delegation/article.md index 41df9f079..881183740 100644 --- a/2-ui/2-events/03-event-delegation/article.md +++ b/2-ui/2-events/03-event-delegation/article.md @@ -1,7 +1,7 @@ # Event delegation -Capturing and bubbling allow us to implement one of most powerful event handling patterns called *event delegation*. +Capturing and bubbling allow us to implement one of the most powerful event handling patterns called *event delegation*. The idea is that if we have a lot of elements handled in a similar way, then instead of assigning a handler to each of them -- we put a single handler on their common ancestor. From cc74cccffa6fd5a1c1b7a6fdbca2d4ce738ea8eb Mon Sep 17 00:00:00 2001 From: Sarah Lewis <280882+bookchiq@users.noreply.github.com> Date: Thu, 13 Jan 2022 10:06:23 -0800 Subject: [PATCH 11/18] Update article.md Minor grammar fix --- 1-js/02-first-steps/16-function-expressions/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/02-first-steps/16-function-expressions/article.md b/1-js/02-first-steps/16-function-expressions/article.md index 5bdded04a..bca23ae51 100644 --- a/1-js/02-first-steps/16-function-expressions/article.md +++ b/1-js/02-first-steps/16-function-expressions/article.md @@ -12,7 +12,7 @@ function sayHi() { There is another syntax for creating a function that is called a *Function Expression*. -It allows to create a new function in the middle of any expression. +It allows us to create a new function in the middle of any expression. For example: From d5128182a5279889a05ae28cc554db323aff2c4c Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Fri, 21 Jan 2022 10:45:48 +0300 Subject: [PATCH 12/18] minor fixes --- 1-js/02-first-steps/05-types/article.md | 8 +++++--- .../14-regexp-lookahead-lookbehind/article.md | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index ca9039aea..57e08c3ff 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -46,13 +46,15 @@ Besides regular numbers, there are so-called "special numeric values" which also alert( "not a number" / 2 ); // NaN, such division is erroneous ``` - `NaN` is sticky. Any further operation on `NaN` returns `NaN`: + `NaN` is sticky. Any further mathematical operation on `NaN` returns `NaN`: ```js run - alert( "not a number" / 2 + 5 ); // NaN + alert( NaN + 1 ); // NaN + alert( 3 * NaN ); // NaN + alert( "not a number" / 2 - 1 ); // NaN ``` - So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result. + So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result (there's only one exception to that: `NaN ** 0` is `1`). ```smart header="Mathematical operations are safe" Doing maths is "safe" in JavaScript. We can do anything: divide by zero, treat non-numeric strings as numbers, etc. diff --git a/9-regular-expressions/14-regexp-lookahead-lookbehind/article.md b/9-regular-expressions/14-regexp-lookahead-lookbehind/article.md index 04cca7c86..cee8215f9 100644 --- a/9-regular-expressions/14-regexp-lookahead-lookbehind/article.md +++ b/9-regular-expressions/14-regexp-lookahead-lookbehind/article.md @@ -59,6 +59,10 @@ alert( str.match(/\d+\b(?!€)/g) ); // 2 (the price is not matched) ## Lookbehind +```warn header="Lookbehind browser compatibility" +Please Note: Lookbehind is not supported in non-V8 browsers, such as Safari, Internet Explorer. +``` + Lookahead allows to add a condition for "what follows". Lookbehind is similar, but it looks behind. That is, it allows to match a pattern only if there's something before it. From 62b3b9a92bada76044999586b5cb675d14556028 Mon Sep 17 00:00:00 2001 From: joaquinelio Date: Fri, 21 Jan 2022 07:07:30 -0300 Subject: [PATCH 13/18] Update article.md --- 2-ui/3-event-details/7-keyboard-events/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2-ui/3-event-details/7-keyboard-events/article.md b/2-ui/3-event-details/7-keyboard-events/article.md index 7cb1c47ca..86e9b83fd 100644 --- a/2-ui/3-event-details/7-keyboard-events/article.md +++ b/2-ui/3-event-details/7-keyboard-events/article.md @@ -107,7 +107,7 @@ So, `event.code` may match a wrong character for unexpected layout. Same letters To reliably track layout-dependent characters, `event.key` may be a better way. -On the other hand, `event.code` has the benefit of staying always the same, bound to the physical key location. So hotkeys that rely on it work well even in case of a language switch. For example, games that use `key:A` `key:D` for an avatar traveling. +On the other hand, `event.code` has the benefit of staying always the same, bound to the physical key location. So hotkeys that rely on it work well even in case of a language switch. Do we want to handle layout-dependant keys? Then `event.key` is the way to go. From 8b1d32d1f18f8eb5bd930e449307d11e2fa1acdd Mon Sep 17 00:00:00 2001 From: Kolja Zuelsdorf Date: Fri, 21 Jan 2022 11:50:20 +0100 Subject: [PATCH 14/18] added missing "the" --- 1-js/11-async/03-promise-chaining/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/11-async/03-promise-chaining/article.md b/1-js/11-async/03-promise-chaining/article.md index 6da4cb02e..ebf869156 100644 --- a/1-js/11-async/03-promise-chaining/article.md +++ b/1-js/11-async/03-promise-chaining/article.md @@ -120,7 +120,7 @@ new Promise(function(resolve, reject) { }); ``` -Here the first `.then` shows `1` and returns `new Promise(…)` in the line `(*)`. After one second it resolves, and the result (the argument of `resolve`, here it's `result * 2`) is passed on to handler of the second `.then`. That handler is in the line `(**)`, it shows `2` and does the same thing. +Here the first `.then` shows `1` and returns `new Promise(…)` in the line `(*)`. After one second it resolves, and the result (the argument of `resolve`, here it's `result * 2`) is passed on to the handler of the second `.then`. That handler is in the line `(**)`, it shows `2` and does the same thing. So the output is the same as in the previous example: 1 -> 2 -> 4, but now with 1 second delay between `alert` calls. From 34ab022835348d5a047e7f69aafefce72473bbe7 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Fri, 21 Jan 2022 13:52:32 +0300 Subject: [PATCH 15/18] minor fixes --- 1-js/02-first-steps/17-arrow-functions-basics/article.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-js/02-first-steps/17-arrow-functions-basics/article.md b/1-js/02-first-steps/17-arrow-functions-basics/article.md index 967373fc9..c28b56c56 100644 --- a/1-js/02-first-steps/17-arrow-functions-basics/article.md +++ b/1-js/02-first-steps/17-arrow-functions-basics/article.md @@ -33,7 +33,7 @@ let sum = function(a, b) { alert( sum(1, 2) ); // 3 ``` -As you can, see `(a, b) => a + b` means a function that accepts two arguments named `a` and `b`. Upon the execution, it evaluates the expression `a + b` and returns the result. +As you can see, `(a, b) => a + b` means a function that accepts two arguments named `a` and `b`. Upon the execution, it evaluates the expression `a + b` and returns the result. - If we have only one argument, then parentheses around parameters can be omitted, making that even shorter. @@ -86,7 +86,7 @@ Like this: let sum = (a, b) => { // the curly brace opens a multiline function let result = a + b; *!* - return result; // if we use curly braces, then we need an explicit "return" + return result; // if we use curly braces, then we need an explicit "return" */!* }; From 674a9a417acfbd573d373303822aa80d1dc90fee Mon Sep 17 00:00:00 2001 From: Erol Aliyev Date: Sat, 22 Jan 2022 19:13:44 +0100 Subject: [PATCH 16/18] Correction to precedence levels Nullish coalescing and logical OR both eqaul to 4 now in MDN table. --- 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 b84dff892..6f3e969f9 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 @@ -106,7 +106,7 @@ In practice, the zero height is often a valid value, that shouldn't be replaced ## Precedence -The precedence of the `??` operator is about the same as `||`, just a bit lower. It equals `5` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table), while `||` is `6`. +The precedence of the `??` operator is the same as `||`. They both equal `4` in the [MDN table](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table). That means that, just like `||`, the nullish coalescing operator `??` is evaluated before `=` and `?`, but after most other operations, such as `+`, `*`. From 82e5d13b8985486b72a4e714256d4c46d8bcbec4 Mon Sep 17 00:00:00 2001 From: Omid Heidarzadeh Date: Sat, 22 Jan 2022 22:29:27 +0330 Subject: [PATCH 17/18] fix:Add missing test #2826 & fix related solution --- .../04-object-methods/8-chain-calls/_js.view/solution.js | 1 + .../04-object-methods/8-chain-calls/_js.view/test.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/solution.js b/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/solution.js index e98fe6410..a35c009cc 100644 --- a/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/solution.js +++ b/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/solution.js @@ -11,5 +11,6 @@ let ladder = { }, showStep: function() { alert(this.step); + return this; } }; \ No newline at end of file diff --git a/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/test.js b/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/test.js index a2b17fcc4..b4f2459b7 100644 --- a/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/test.js +++ b/1-js/04-object-basics/04-object-methods/8-chain-calls/_js.view/test.js @@ -32,6 +32,14 @@ describe('Ladder', function() { it('down().up().up().up() ', function() { assert.equal(ladder.down().up().up().up().step, 2); }); + + it('showStep() should return this', function() { + assert.equal(ladder.showStep(), ladder); + }); + + it('up().up().down().showStep().down().showStep()', function () { + assert.equal(ladder.up().up().down().showStep().down().showStep().step, 0) + }); after(function() { ladder.step = 0; From b070c4147bf902b1f7dd708f7dca8abccb708b34 Mon Sep 17 00:00:00 2001 From: Osvaldo Dias dos Santos Date: Sun, 30 Jan 2022 23:07:51 +0100 Subject: [PATCH 18/18] Resolve conflicts --- 1-js/02-first-steps/05-types/article.md | 12 ++---------- .../17-arrow-functions-basics/article.md | 8 -------- 1-js/11-async/03-promise-chaining/article.md | 6 +----- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/1-js/02-first-steps/05-types/article.md b/1-js/02-first-steps/05-types/article.md index aa28df4c2..d91f27c29 100644 --- a/1-js/02-first-steps/05-types/article.md +++ b/1-js/02-first-steps/05-types/article.md @@ -46,11 +46,7 @@ Além dos números regulares, existem os chamados "valores numéricos especiais" alert( "not a number" / 2 ); // NaN, tal divisão é errônea ``` -<<<<<<< HEAD - `NaN` é pegajoso. Qualquer outra operação em `NaN` retorna `NaN`: -======= - `NaN` is sticky. Any further mathematical operation on `NaN` returns `NaN`: ->>>>>>> bae0ef44d0208506f6e9b7f3421ee640ab41af2b + `NaN` é pegajoso. Qualquer outra operação matemática com `NaN` retorna `NaN`: ```js run alert( NaN + 1 ); // NaN @@ -58,11 +54,7 @@ Além dos números regulares, existem os chamados "valores numéricos especiais" alert( "not a number" / 2 - 1 ); // NaN ``` -<<<<<<< HEAD - Então, se há um `NaN` em algum lugar em uma expressão matemática, ele se propaga para o resultado inteiro. -======= - So, if there's a `NaN` somewhere in a mathematical expression, it propagates to the whole result (there's only one exception to that: `NaN ** 0` is `1`). ->>>>>>> bae0ef44d0208506f6e9b7f3421ee640ab41af2b + Então, se há um `NaN` em algum lugar em uma expressão matemática, ele se propaga para o resultado inteiro (existe apenas uma exceção nisto: `NaN ** 0` é `1`). ```smart header="As operações matemáticas são seguras" Fazer matemática é "seguro" em JavaScript. Podemos fazer qualquer coisa: dividir por zero, tratar strings não-numéricas como números, etc. diff --git a/1-js/02-first-steps/17-arrow-functions-basics/article.md b/1-js/02-first-steps/17-arrow-functions-basics/article.md index ff2e11254..3728b4898 100644 --- a/1-js/02-first-steps/17-arrow-functions-basics/article.md +++ b/1-js/02-first-steps/17-arrow-functions-basics/article.md @@ -33,11 +33,7 @@ let sum = function(a, b) { alert( sum(1, 2) ); // 3 ``` -<<<<<<< HEAD Como pode ver, `(a, b) => a + b` significa uma função que aceita dois argumentos, nomeadamente `a` e `b`. No momento da execução, esta avalia a expressão `a + b` e retorna o resultado. -======= -As you can see, `(a, b) => a + b` means a function that accepts two arguments named `a` and `b`. Upon the execution, it evaluates the expression `a + b` and returns the result. ->>>>>>> bae0ef44d0208506f6e9b7f3421ee640ab41af2b - Se tivermos apenas um argumento, então os parênteses à sua volta podem ser omitidos, tornando ela ainda mais curta. @@ -90,11 +86,7 @@ Desta forma: let sum = (a, b) => { // a chaveta abre uma função multi-linha let result = a + b; *!* -<<<<<<< HEAD return result; // se usarmos chavetas, então precisamos de um "return" explícito -======= - return result; // if we use curly braces, then we need an explicit "return" ->>>>>>> bae0ef44d0208506f6e9b7f3421ee640ab41af2b */!* }; diff --git a/1-js/11-async/03-promise-chaining/article.md b/1-js/11-async/03-promise-chaining/article.md index 6e94ef5f5..8c621c3b4 100644 --- a/1-js/11-async/03-promise-chaining/article.md +++ b/1-js/11-async/03-promise-chaining/article.md @@ -120,11 +120,7 @@ new Promise(function(resolve, reject) { }); ``` -<<<<<<< HEAD -Aqui o primeiro `.then` exibe `1` e retorna `new Promise(…)` na linha `(*)`. Após 1 segundo ele é resolvido, e o resultado (o argumento de `resolve`, no caso é `result * 2`) é passado ao tratador do segundo `.then`. O tratador está na linha `(**)`, ele exibe `2` e faz a mesma coisa. -======= -Here the first `.then` shows `1` and returns `new Promise(…)` in the line `(*)`. After one second it resolves, and the result (the argument of `resolve`, here it's `result * 2`) is passed on to the handler of the second `.then`. That handler is in the line `(**)`, it shows `2` and does the same thing. ->>>>>>> bae0ef44d0208506f6e9b7f3421ee640ab41af2b +Aqui o primeiro `.then` exibe `1` e retorna `new Promise(…)` na linha `(*)`. Após 1 segundo ela é resolvida, e o resultado (o argumento de `resolve`, aqui é `result * 2`) é passado ao tratador do segundo `.then`. O tratador está na linha `(**)`, ele exibe `2` e faz a mesma coisa. Então a saída é a mesma que no exemplo anterior: 1 -> 2 -> 4, mas agora com 1 segundo de atraso entre as chamadas `alert`.