Skip to content

Commit 6198913

Browse files
authored
Merge branch 'master' into 1-03-05
2 parents 58b0310 + 6cee922 commit 6198913

File tree

9 files changed

+433
-435
lines changed

9 files changed

+433
-435
lines changed

1-js/02-first-steps/15-function-expressions-arrows/1-rewrite-arrow/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ ask(
1414
);
1515
```
1616

17-
Looks short and clean, right?
17+
看起來簡潔多了,對吧?

1-js/02-first-steps/15-function-expressions-arrows/1-rewrite-arrow/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
# Rewrite with arrow functions
2+
# 用箭頭函式重寫
33

4-
Replace Function Expressions with arrow functions in the code:
4+
用箭頭函式取代下列程式碼中的函式表達式:
55

66
```js run
77
function ask(question, yes, no) {

1-js/02-first-steps/15-function-expressions-arrows/article.md

Lines changed: 126 additions & 126 deletions
Large diffs are not rendered by default.

1-js/03-code-quality/02-coding-style/1-style-errors/solution.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11

2-
You could note the following:
2+
你可以注意到以下幾點:
33

44
```js no-beautify
5-
function pow(x,n) // <- no space between arguments
6-
{ // <- figure bracket on a separate line
7-
let result=1; // <- no spaces before or after =
8-
for(let i=0;i<n;i++) {result*=x;} // <- no spaces
9-
// the contents of { ... } should be on a new line
5+
function pow(x,n) // <- 引數間沒有空格
6+
{ // <- 大括號自成一行了
7+
let result=1; // <- = 前後沒有空格
8+
for(let i=0;i<n;i++) {result*=x;} // <- 沒有空格
9+
// { ... } 的內容應該要在新的一行
1010
return result;
1111
}
1212

13-
let x=prompt("x?",''), n=prompt("n?",'') // <-- technically possible,
14-
// but better make it 2 lines, also there's no spaces and missing ;
15-
if (n<0) // <- no spaces inside (n < 0), and should be extra line above it
16-
{ // <- figure bracket on a separate line
17-
// below - long lines can be split into multiple lines for improved readability
13+
let x=prompt("x?",''), n=prompt("n?",'') // <-- 技術上雖可行,
14+
// 但最好還是拆成兩行,此外也沒有空格,又缺少分號 ;
15+
if (n<0) // <- (n < 0) 缺少空格,而且應該在上方要有額外的一行
16+
{ // <- 大括號自成一行了
17+
// 底下這行太長了,可以拆分成多行以增加可讀性
1818
alert(`Power ${n} is not supported, please enter an integer number greater than zero`);
1919
}
20-
else // <- could write it on a single line like "} else {"
20+
else // <- 可以像這樣 "} else {" 寫成一行
2121
{
22-
alert(pow(x,n)) // no spaces and missing ;
22+
alert(pow(x,n)) // 沒有空格且缺少分號 ;
2323
}
2424
```
2525

26-
The fixed variant:
26+
修改後的寫法:
2727

2828
```js
2929
function pow(x, n) {
@@ -46,3 +46,4 @@ if (n < 0) {
4646
alert( pow(x, n) );
4747
}
4848
```
49+

1-js/03-code-quality/02-coding-style/1-style-errors/task.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ importance: 4
22

33
---
44

5-
# Bad style
5+
# 不良的風格
66

7-
What's wrong with the code style below?
7+
底下的程式碼風格有什麼問題?
88

99
```js no-beautify
1010
function pow(x,n)
@@ -25,4 +25,5 @@ else
2525
}
2626
```
2727

28-
Fix it.
28+
修正它。
29+

0 commit comments

Comments
 (0)