Skip to content

Commit dd02efb

Browse files
ArvinHlex111baooabdashaezhovaimabp
authored
Sync with upstream (#93)
* Fix typo It was not mentioned earlier in the article that “A property can be either an accessor (has get/set methods) or a data property (has a value), not both” So,we should not say "once again". * Update 'Selection and Range' article.md * Translated tasks to English * Translated line 10 content to English * Translated Solution from Russian to English * Translated to English and updated. * Fix typo * Function return example update * minor fixes * Change panel names according to official documentation * article.md Typo fix. * Update article.md A small grammar change and fixing a typo (I think) (no -> not). * Update article.md Actually taking out a comma. * minor fixes * minor fixes * minor fixes * fix typo * fix: spell correction to existence * Update article.md As threatened, change line 34, "to summarize: ..." Also add "these" before "internal properties". * Update article.md Removed extraneous quote mark I had accidentally inserted. * Update article.md Small punctuation change. Separately, I didn't change anything on this today, but note that line 34 above: "So to summarize: the executor runs automatically and attempts to perform a job. When it is finished with the attempt it calls `resolve` if it was successful or `reject` if there was an error." was, before it was changed recently, pretty much the same as line 82 above: "To summarize, the executor should perform a job (usually something that takes time) and then call `resolve` or `reject` to change the state of the corresponding promise object." So maybe some revision there is in order -- to not have both, or to change one or both. Not familiar enough with the article at this point to make the revision. * minor fixes * Update article.md Corrected grammatical errors. * Fixing a typo Check if `pattern:Y` is immediately after `pattern:X` and then the regex will check if Z is immediately after Y, Like this it's more understandable. * Update article.md Change "occasional" to "accidental". I think that's what you mean, and the words are not synonymous in English. * Update article.md "continues to closest" -> "continues to next closest". Consistent w/ usage in rest of explanation. * Fix typo in 11-coordinates/article.md A minor typo issue : polywill -> polyfill * adding the `[^]` pattern * minor fixes * Update article.md "allows to use" -> "allows us to use" "to use with await" -> "to use it with await" * Update article.md A few syntactic and punctuation changes to 'The “try…catch” syntax' section. * Update article.md "can use" -> "we can use". * Update article.md Maybe clarifying a bit where `.json()` comes from. I personally found it a bit confusing at first. * Update article.md "We can get loop over values by `for..of`:" -> "We can loop over their values using `for..of`" * minor fixes * minor fixes * minor fixes * Update article.md ", we have an object that is not an array, " -> ", we have an object that is not an array, " * Update article.md "yield is a two-way road" -> "yield is a two-way street" "Two way street" is by far the more common and accepted way to say this. If you look up "two-way road" you will typically be redirected to "two-way street". * Update article.md "returns the result outside" -> "returns the result to the outside" * Update article.md Several punctuation changes, yielding: "1. We use the browser [fetch](info:fetch) method to download from a remote URL. It allows us to supply authorization and other headers if needed -- here GitHub requires `User-Agent`. 2. The fetch result is parsed as JSON. That's again a `fetch`-specific method. 3. We should get the next page URL from the `Link` header of the response. It has a special format, so we use a regexp for that. The next page URL may look like `https://api.github.com/repositories/93253246/commits?page=2`. It's generated by GitHub itself. 4. Then we yield all commits received, and when they finish, the next `while(url)` iteration will trigger, making one more request." * Update article.md "such as browsers" -> "like in browsers" * Update article.md "`import` allows to import functionality.." -> "`import` allows the import of functionality..." "relative the current file" -> "relative to the current file," * Update article.md "That's the correct variant:" -> "This is the correct variant:" * Update article.md "Let's see that on examples." -> "Let's look at them using examples:" * Update article.md "allows to configure" -> "allows us to configure" * Update article.md "be aware that HTML-page" -> "be aware that the HTML page" * Update article.md "`async` attribute" -> "the `async` attribute" * fix en #1739 * minor fixes * Revert "minor fixes" This reverts commit e4fb777. * Revert "Revert "minor fixes"" This reverts commit d6035ee. * Update article.md "better convenience" -> "more convenience" * Update article.md "That's not a function" -> "It's not a function" * Update article.md "chapter" -> "article" (6 times or so) I believe that is consistent with the agreed-upon terminology. * Update article.md "as `Proxy` trap" -> "as the `Proxy` trap" * Fix link in BigInt * Remove extra word * Typo fix * Grammar mistake (?) It literally says «Operating System system functions.» * Update article.md add semicolon at end -> " return prop >= target.start && prop <= target.end;" * Update article.md "return `undefined`" -> "returns `undefined`" * Update article.md "on the paper" -> "on paper" * False precedence numbers According to the MDN precedence-table you've linked some precedence numbers are incorrect. Having a quick look at different language versions (French and Russian) this error may has to be corrected at every version. * Update article.md "chapter" -> "article" 2x * Update article.md "returns to event loop" -> "returns to the event loop" "no much difference" -> "not much difference" * Update article.md "move the scheduling to the beginning" (2x) * closes #1747 * Update article.md "similar stuff to described above" -> "similar stuff to what's described above" * Update article.md "roll our own" -> "roll your own" "can see that's" - "can see that that's" * Fix translation * Either quotation marks or italicization Highlighting twice is unnecessary. * Update article.md "big text" -> "large amount of text" "evade problems" -> "avoid problems" "another 100 lines" -> "for the next 100 lines" "To demonstrate the approach" -> "To demonstrate this approach" "instead of syntax-highlighting" -> "instead of text-highlighting," * Update article.md "using nested `setTimeout`:" -> "using nested `setTimeout` calls:" * Update article.md 'The browser may even show "the script..." warning' -> 'The browser may even show a "the script..." warning' * Update article.md "to react on other user actions" -> "to react to other user actions" (a little more natural sounding) * Update article.md "From one hand" -> "On one hand" * Update article.md "get in details" -> "get in to the details" * Update article.md "if arguments count" -> "if the arguments count" "allows to easily" -> "allows us to easily" "seen in the logging example:" -> "seen in the logging example," rephrasing rest of above sentence for readability * Remove unnecessary return in couple of examples * fixes #1747 * Update article.md * Fix typo * fix: Minor typo and grammar * edited alice's wage difference, wage is based on the average of her male counterparts and rounded up for easy comprehension. * minor fixes * closes #1742 * Mac OS multiline Commenting shortcut is should use 'Option' instead of 'Shift' #1743 Fix Submitted. * closes #1758 * Copy and paste mistake The code never has been not OK. It's just a copy from an example of the chapter before. * "better to demonstrate" -> "best demonstrated", ", like this:" -> ":" * Update article.md * Some missing whitespaces * Update article.md * small typo fix element.addEventListener(event, handler[, options]); TO element.addEventListener(event, handler, [options]); * Fix typo Changed "it's" to "its" since that is the correct spelling of the possessive form of "it." * Fix typo * Add commas non-terminal properties * Update article.md Rephrasing introductory sentences about async iterators and generators. * Update article.md "allows to" -> "allows us to" (3x) * Update article.md "we should use `for...loop`" -> "we should use a `for...loop`" * "allows to" -> "allows us to" (2x) * Update article.md * Remove useless spaces they have no effect on the article's appearance * Fix typo. * minor fixes * corrected order for subtraction * minor fixes * fix typo Number should be 79031234567 not 79035419441 * fix: removed , from solution.md date data types * fix: removed , from task.md date data types * Corrected Grammar * Fix typo * Fix a typo * Fix a typo * fix: 2 lines of russian to english and a typo (mathces -> matches) * fix: fix markdown highlight * Create index.html * Update index.html * Update index.html * Update solution.md * Update article.md * minor fixes - fix erratas - fix wrong error message - add 'run' on runnable example - add explanation about window.onload property corresponding load event - add comment about window.onstorage property corresponding storage event * Minor statement change * Update article.md * minor fixes * closes #1791 * fixes #1794 * closes #1794 * Update solution.md * Update article.md * closes #1808 * closes #1812 * minor fixes * Edit sentance syntax in closure article * Update solution.md * formatting * Update article.md * Update article.md * Update article.md * fix typo * Update article.md * Update article.md * Update article.md * fix typo * Update article.md * trick get a new copy of objects/arrays using the spread operator * fix missing js formatting * Update article.md * do the same => do the same thing * Fixing "sum(1)" instead of "curriedSum(1)" (l. 42) "sum(1)" doesn't return a wrapper, "curriedSum(1)" does. * Change 'brackets' to 'parentheses' I think this is the way it is typically used here and elsewhere. reserving "brackets" without a qualifier for indicating square brackets., so probably no explanation is necessary. But, for those who want to know more: It does seem to be the case that in British English "brackets" typically means "round brackets", which are parentheses, but in American English "brackets" typically means square brackets ("[]"). Admittedly, "brackets" is easier to spell. And to pronounce. Even to type, once you get used to it. * Change 'brackets' to 'parentheses' Again, in American English, and programming, "brackets" usually means "square brackets". "Parentheses" is unambiguous. * Update article.md * fix an anchor link error Object.assign() is referring to wrong article, which is Sympol. so I fix it to the right article "objects" with the right section #Cloning and merging, Object.assign * Update article.md * fixes #1836 * closes #1810 * fix minor typo "synctax" to "syntax" * Change switch Grouping of "case" example Change switch Grouping of "case" example * up * minor fixes * minor fixes * chapter -> article (3x) * Various small wording and punctuation changes Co-authored-by: Alexey Pyltsyn <[email protected]> Co-authored-by: zhangbao <[email protected]> Co-authored-by: Daria Pimenova <[email protected]> Co-authored-by: Abir <[email protected]> Co-authored-by: dpyzo0o <[email protected]> Co-authored-by: Marco Dizo <[email protected]> Co-authored-by: Ilya Kantor <[email protected]> Co-authored-by: Ilya Kantor <[email protected]> Co-authored-by: tarasyyyk <[email protected]> Co-authored-by: va-z <[email protected]> Co-authored-by: Peter Roche <[email protected]> Co-authored-by: Zeel <[email protected]> Co-authored-by: Aniket Kudale <[email protected]> Co-authored-by: Violet Bora Lee <[email protected]> Co-authored-by: Beginnerds <[email protected]> Co-authored-by: Sohail Ashraf <[email protected]> Co-authored-by: Daniel Hong <[email protected]> Co-authored-by: Kin Lum <[email protected]> Co-authored-by: qdflavel <[email protected]> Co-authored-by: u-n-known <[email protected]> Co-authored-by: Georgy <[email protected]> Co-authored-by: Yury Nekhaevskiy <[email protected]> Co-authored-by: Rizky <[email protected]> Co-authored-by: Arinze Chianumba <[email protected]> Co-authored-by: Kelly K H <[email protected]> Co-authored-by: Nishant <[email protected]> Co-authored-by: Bibin Mathew <[email protected]> Co-authored-by: LeviDing <[email protected]> Co-authored-by: jorishr <[email protected]> Co-authored-by: Daniel Tinsley <[email protected]> Co-authored-by: YRFT <[email protected]> Co-authored-by: Dương Đỗ Minh Châu <[email protected]> Co-authored-by: Alex Galkin <[email protected]> Co-authored-by: Larry Ng <[email protected]> Co-authored-by: Kuthumi Pepple <[email protected]> Co-authored-by: Chao Zhang <[email protected]> Co-authored-by: HynekS <[email protected]> Co-authored-by: Xin Nie <[email protected]> Co-authored-by: Etheraex <[email protected]> Co-authored-by: Michael McGee <[email protected]> Co-authored-by: wonderingabout <[email protected]> Co-authored-by: Aakodal <[email protected]> Co-authored-by: Ahmed Magdy Seleem <[email protected]> Co-authored-by: Sambalim <[email protected]>
1 parent 280a076 commit dd02efb

File tree

255 files changed

+1571
-1132
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+1571
-1132
lines changed

Diff for: 1-js/01-getting-started/1-intro/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## 什麼是 JavaScript?
66

7-
*JavaScript* 最初是為了 *"賦予網頁活力"*
7+
*JavaScript* 最初是為了 *"賦予網頁活力"* 而創造的
88

99
這種程式語言我們稱之為 *腳本*,它們可以被寫入網頁 HTML 中,並在頁面讀取時自動執行。
1010

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<body>
5+
6+
<script>
7+
alert( "I'm JavaScript!" );
8+
</script>
9+
10+
</body>
11+
12+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
[html src="index.html"]

Diff for: 1-js/02-first-steps/02-structure/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ alert("There will be an error")[1, 2].forEach(alert)
9393

9494
我們建議即使是依據換行分開的述句也要標上分號,這個規則被社群廣為採納。再次強調 -- 大多時間 *可能* 可以省略分號,但加上分號會更安全,尤其對新手而言。
9595

96-
## 註解
96+
## 註解 [#code-comments]
9797

9898
程式碼會隨著時間變得越來越複雜,有其必要加入 *註解* 來解釋程式在做什麼且為什麼這麼做。
9999

@@ -135,7 +135,7 @@ alert('World');
135135
```
136136

137137
```smart header="用熱鍵!"
138-
大多數編輯器中,可以按下 `key:Ctrl+/` 這個熱鍵來註解掉單行程式碼,而 `key:Ctrl+Shift+/` 可以註解多行(選取一段程式碼後按下熱鍵)。Mac 則使用 `key:Cmd` 取代 `key:Ctrl`。
138+
大多數編輯器中,可以按下 `key:Ctrl+/` 這個熱鍵來註解掉單行程式碼,而 `key:Ctrl+Shift+/` 可以註解多行(選取一段程式碼後按下熱鍵)。Mac 則使用 `key:Cmd` 取代 `key:Ctrl`;`key:Option` 取代 `key:Shift`
139139
```
140140

141141
````warn header="不支援巢狀註解!"

Diff for: 1-js/02-first-steps/05-types/article.md

+26-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ message = 123456;
1010

1111
若允許這麼做的程式語言,稱其具有 "動態類型(dynamically typed)",意思是變數不會綁定任一種資料類型。
1212

13-
JavaScript 中有七種基礎的資料類型,在此我們會稍微介紹下它們,然後在接下來的章節中我們會逐一介紹其細節:
13+
JavaScript 中有八種基礎的資料類型,在此我們會稍微介紹下它們,然後在接下來的章節中我們會逐一介紹其細節:
1414

1515
## 數值(A number)
1616

@@ -63,7 +63,26 @@ n = 12.345;
6363

6464
我們會在章節 <info:number> 中看到更多使用數值的方式。
6565

66-
## 字串(A string)
66+
## BigInt 類型
67+
68+
在 JavaScript 中,"number" 類型沒辦法代表大於 <code>2<sup>53</sup></code> (或小於 <code>-2<sup>53</sup></code> )的整數,這是其內部表示系統上的技術限制。這大約是 16 位十進位數字,在大多數的情況下,這個限制都不是問題,但有時我們真的需要很大的數字,例如用於密碼學或是精準度到 microsecond 的時間戳記。
69+
70+
`BigInt` 類型最近被加入到 JavaScript 語言中,用於表示任意長度的整數。
71+
72+
可以通過將 `n` 加入整數字面值的尾部來創建 `BigInt`
73+
74+
```js
75+
// 有個 "n" 在其尾部,代表這是一個 BigInt
76+
const bigInt = 1234567890123456789012345678901234567890n;
77+
```
78+
79+
As `BigInt` numbers are rarely needed, we devoted them a separate chapter <info:bigint>.
80+
81+
```smart header="Compatability issues"
82+
Right now `BigInt` is supported in Firefox and Chrome, but not in Safari/IE/Edge.
83+
```
84+
85+
## 字串(String
6786

6887
JavaScript 中的字串(string)必須被引號(quotes)所環繞。
6988

@@ -108,7 +127,7 @@ alert( "the result is ${1 + 2}" ); // the result is ${1 + 2}(雙引號什麼
108127
在 JavaScript 中沒有這種類型,只有一種 `字串` 類型。一串字串可以只有一個或擁有多個字元在內。
109128
```
110129

111-
## 布林(A boolean)(邏輯類型)
130+
## 布林(Boolean)(邏輯類型)
112131

113132
布林(boolean)類型只有兩種值:`true``false`
114133

@@ -199,6 +218,8 @@ typeof undefined // "undefined"
199218

200219
typeof 0 // "number"
201220

221+
typeof 10n // "bigint"
222+
202223
typeof true // "boolean"
203224

204225
typeof "foo" // "string"
@@ -227,9 +248,10 @@ typeof alert // "function"(3)
227248

228249
## 總結
229250

230-
在 JavaScript 中有 7 種基礎資料類型:
251+
在 JavaScript 中有 8 種基礎資料類型:
231252

232253
- `number` 用於任何類型的數值:整數或浮點數。
254+
- `bigint` 用於任意長度的整數。
233255
- `string` 用於字串。一個字串可以包含一個或多個字元,但不獨立存在單一字元的類型。
234256
- `boolean` 用於 `true``false`
235257
- `null` 用於未知的值 -- 只有一個值 `null` 的獨立類型。

Diff for: 1-js/02-first-steps/06-type-conversions/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ alert( '1' + 2 ); // '12'(左側為字串)
9494
這只發生在當至少一側的引數是字串時,否則值都會被轉為數值。
9595
````
9696

97-
## Boolean Conversion
97+
# Boolean Conversion
9898

9999
布林轉換是最簡單的一個。
100100

Diff for: 1-js/02-first-steps/07-operators/article.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,17 @@ JavaScript 中有許多運算子,每個運算子都有個對應的優先權號
137137
| 優先權 | 名稱 | 符號 |
138138
|------------|------|------|
139139
| ... | ... | ... |
140-
| 16 | 一元正號 | `+` |
141-
| 16 | 一元負號 | `-` |
142-
| 14 | 乘法 | `*` |
143-
| 14 | 除法 | `/` |
140+
| 17 | 一元正號 | `+` |
141+
| 17 | 一元負號 | `-` |
142+
| 15 | 乘法 | `*` |
143+
| 15 | 除法 | `/` |
144144
| 13 | 加法 | `+` |
145145
| 13 | 減法 | `-` |
146146
| ... | ... | ... |
147147
| 3 | 指定 | `=` |
148148
| ... | ... | ... |
149149

150-
我們可以看到,"一元正號運算子" 有著優先權號碼 `16`,比 "加法(二元加法運算子)"`13` 還高。這也是為什麼在表達式 `"+apples + +oranges"` 中,一元正號運算子比加法還要更早運作。
150+
我們可以看到,"一元正號運算子" 有著優先權號碼 `17`,比 "加法(二元加法運算子)"`13` 還高。這也是為什麼在表達式 `"+apples + +oranges"` 中,一元正號運算子比加法還要更早運作。
151151

152152
## 指定運算子(Assignment)
153153

Diff for: 1-js/02-first-steps/11-logical-operators/2-alert-or/solution.md

-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ alert( alert(1) || 2 || alert(3) );
1111
3. 第二個運算元 `2` 是真值,所以執行停止,`2` 被回傳並且被外部的 alert 顯示。
1212

1313
不會顯示 `3`,因為核定根本到不了 `alert(3)`
14-
Loading

Diff for: 1-js/02-first-steps/12-while-for/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ for (let i = 0; i < 10; i++) {
255255
````smart header="`continue` 指令有助於減少巢狀結構"
256256
一個顯示奇數的迴圈也可以長這樣:
257257

258-
```js
258+
```js run
259259
for (let i = 0; i < 10; i++) {
260260

261261
if (i % 2) {

Diff for: 1-js/02-first-steps/13-switch/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Several variants of `case` which share the same code can be grouped.
117117
For example, if we want the same code to run for `case 3` and `case 5`:
118118
119119
```js run no-beautify
120-
let a = 2 + 2;
120+
let a = 3;
121121
122122
switch (a) {
123123
case 4:

Diff for: 1-js/02-first-steps/14-function-basics/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ alert( result ); // 3
262262
263263
```js run
264264
function checkAge(age) {
265-
if (age > 18) {
265+
if (age >= 18) {
266266
*!*
267267
return true;
268268
*/!*

Diff for: 1-js/02-first-steps/16-arrow-functions-basics/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ let welcome = (age < 18) ?
6767
() => alert('Hello') :
6868
() => alert("Greetings!");
6969
70-
welcome(); // ok now
70+
welcome();
7171
```
7272

7373
在剛開始使用箭頭函式時,可能會覺得不熟悉且閱讀性不那麼好,但習慣這種結構後,情況會迅速改變。

Diff for: 1-js/02-first-steps/17-javascript-specials/article.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ let x = 5;
8383
x = "John";
8484
```
8585

86-
7 種資料類型:
86+
8 種資料類型:
8787

8888
- `number` 可以是浮點數或是整數。
89+
- `bigint` 任意長度的整數。
8990
- `string` 字串類型。
9091
- `boolean` 表達邏輯的值: `true/false`
9192
- `null` -- 具有單一值 `null` 的類型,代表 "空的" 或 "不存在"。

0 commit comments

Comments
 (0)