File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2119,12 +2119,16 @@ class Alpaca {}
21192119** [ ⬆ 返回顶部] ( #代码整洁的-javascript ) **
21202120
21212121
2122- ### Function callers and callees should be close
2122+ ### 函数的调用方与被调用方应该靠近
21232123If a function calls another, keep those functions vertically close in the source
21242124file. Ideally, keep the caller right above the callee. We tend to read code from
21252125top-to-bottom, like a newspaper. Because of this, make your code read that way.
21262126
2127- ** Bad:**
2127+ 如果一个函数调用另一个, 则在代码中这两个函数的竖直位置应该靠近。 理想情况下,保持被调用函数在被
2128+ 调用函数的正上方。 我们倾向于从上到下阅读代码, 就像读一章报纸。 由于这个原因, 保持你的代码可
2129+ 以按照这种方式阅读。
2130+
2131+ ** 不好的:**
21282132``` javascript
21292133class PerformanceReview {
21302134 constructor (employee ) {
@@ -2163,7 +2167,7 @@ const review = new PerformanceReview(user);
21632167review .perfReview ();
21642168```
21652169
2166- ** Good ** :
2170+ ** 好的: **
21672171``` javascript
21682172class PerformanceReview {
21692173 constructor (employee ) {
You can’t perform that action at this time.
0 commit comments