Skip to content

Commit bb99fbb

Browse files
committed
Function callers and callees should be close
1 parent fdae9ad commit bb99fbb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README-zh-CN.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,12 +2119,16 @@ class Alpaca {}
21192119
**[⬆ 返回顶部](#代码整洁的-javascript)**
21202120

21212121

2122-
### Function callers and callees should be close
2122+
### 函数的调用方与被调用方应该靠近
21232123
If a function calls another, keep those functions vertically close in the source
21242124
file. Ideally, keep the caller right above the callee. We tend to read code from
21252125
top-to-bottom, like a newspaper. Because of this, make your code read that way.
21262126

2127-
**Bad:**
2127+
如果一个函数调用另一个, 则在代码中这两个函数的竖直位置应该靠近。 理想情况下,保持被调用函数在被
2128+
调用函数的正上方。 我们倾向于从上到下阅读代码, 就像读一章报纸。 由于这个原因, 保持你的代码可
2129+
以按照这种方式阅读。
2130+
2131+
**不好的:**
21282132
```javascript
21292133
class PerformanceReview {
21302134
constructor(employee) {
@@ -2163,7 +2167,7 @@ const review = new PerformanceReview(user);
21632167
review.perfReview();
21642168
```
21652169

2166-
**Good**:
2170+
**好的:**
21672171
```javascript
21682172
class PerformanceReview {
21692173
constructor(employee) {

0 commit comments

Comments
 (0)