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/4-devtools/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
@@ -8,7 +8,7 @@ Para que possamos visualizar erros e obter muitas outras informações úteis so
8
8
9
9
A maioria dos desenvolvedores escolhem o Chrome ou o Firefox para o desenvolvimento porque esses navegadores têm as melhores ferramentas de desenvolvedor. Outros navegadores também fornecem ferramentas de desenvolvedor, às vezes com recursos especiais, mas geralmente estão jogando "catch-up" no Chrome ou Firefox. Assim, a maioria dos desenvolvedores tem um navegador "favorito" e muda para outros se um problema é específico do navegador.
10
10
11
-
As ferramentas do desenvolvedor são potentes; elas têm muitos recursos. Para começar, vamos aprender como abri-las, olhar para erros e executar comandos JavaScript.
11
+
As ferramentas do desenvolvedor são potentes; elas têm muitos recursos. Para começar, vamos aprender como as abrir, olhar para erros e executar comandos JavaScript.
Copy file name to clipboardExpand all lines: 1-js/05-data-types/05-array-methods/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
@@ -743,7 +743,7 @@ These methods are the most used ones, they cover 99% of use cases. But there are
743
743
744
744
The function `fn` is called on each element of the array similar to `map`. If any/all results are `true`, returns `true`, otherwise `false`.
745
745
746
-
These methods behave sort of like `||` and `&&` operators: if `fn`returns a truthy value, `arr.some()` immediately returns `true` and stops iterating over the rest items; if `fn` returns a falsy value, `arr.every()` immediately returns `false` and stops iterating over the rest items as well.
746
+
These methods behave sort of like `||` and `&&` operators: if `fn` returns a truthy value, `arr.some()` immediately returns `true` and stops iterating over the rest items; if `fn` returns a falsy value, `arr.every()` immediately returns `false` and stops iterating over the rest items as well.
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/01-recursion/02-factorial/solution.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
@@ -1,4 +1,4 @@
1
-
By definition, a factorial is `n!` can be written as `n * (n-1)!`.
1
+
By definition, a factorial `n!` can be written as `n * (n-1)!`.
2
2
3
3
In other words, the result of `factorial(n)` can be calculated as `n` multiplied by the result of `factorial(n-1)`. And the call for `n-1` can recursively descend lower, and lower, till `1`.
Copy file name to clipboardExpand all lines: 1-js/06-advanced-functions/01-recursion/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
@@ -132,7 +132,7 @@ We can sketch it as:
132
132
</li>
133
133
</ul>
134
134
135
-
That's when the function starts to execute. The condition `n == 1` is false, so the flow continues into the second branch of `if`:
135
+
That's when the function starts to execute. The condition `n == 1` is falsy, so the flow continues into the second branch of `if`:
136
136
137
137
```js run
138
138
function pow(x, n) {
@@ -188,7 +188,7 @@ The new current execution context is on top (and bold), and previous remembered
188
188
When we finish the subcall -- it is easy to resume the previous context, because it keeps both variables and the exact place of the code where it stopped.
189
189
190
190
```smart
191
-
Here in the picture we use the word "line", as our example there's only one subcall in line, but generally a single line of code may contain multiple subcalls, like `pow(…) + pow(…) + somethingElse(…)`.
191
+
Here in the picture we use the word "line", as in our example there's only one subcall in line, but generally a single line of code may contain multiple subcalls, like `pow(…) + pow(…) + somethingElse(…)`.
192
192
193
193
So it would be more precise to say that the execution resumes "immediately after the subcall".
Copy file name to clipboardExpand all lines: 1-js/11-async/06-promisify/article.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,11 +36,11 @@ Here it is:
36
36
letloadScriptPromise=function(src) {
37
37
returnnewPromise((resolve, reject) => {
38
38
loadScript(src, (err, script) => {
39
-
if (err) reject(err)
39
+
if (err) reject(err);
40
40
elseresolve(script);
41
41
});
42
-
})
43
-
}
42
+
});
43
+
};
44
44
45
45
// usage:
46
46
// loadScriptPromise('path/script.js').then(...)
@@ -71,7 +71,7 @@ function promisify(f) {
71
71
f.call(this, ...args); // call the original function
72
72
});
73
73
};
74
-
};
74
+
}
75
75
76
76
// usage:
77
77
let loadScriptPromise =promisify(loadScript);
@@ -82,7 +82,7 @@ The code may look a bit complex, but it's essentially the same that we wrote abo
82
82
83
83
A call to `promisify(f)` returns a wrapper around `f``(*)`. That wrapper returns a promise and forwards the call to the original `f`, tracking the result in the custom callback `(**)`.
84
84
85
-
Here, `promisiefy` assumes that the original function expects a callback with exactly two arguments `(err, result)`. That's what we encounter most often. Then our custom callback is in exactly the right format, and `promisify` works great for such a case.
85
+
Here, `promisify` assumes that the original function expects a callback with exactly two arguments `(err, result)`. That's what we encounter most often. Then our custom callback is in exactly the right format, and `promisify` works great for such a case.
86
86
87
87
But what if the original `f` expects a callback with more arguments `callback(err, res1, res2)`?
88
88
@@ -110,11 +110,11 @@ function promisify(f, manyArgs = false) {
110
110
f.call(this, ...args);
111
111
});
112
112
};
113
-
};
113
+
}
114
114
115
115
// usage:
116
116
f =promisify(f, true);
117
-
f(...).then(arrayOfResults=>..., err=>...)
117
+
f(...).then(arrayOfResults=>..., err=>...);
118
118
```
119
119
120
120
As you can see it's essentially the same as above, but `resolve` is called with only one or all arguments depending on whether `manyArgs` is truthy.
0 commit comments