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 {}
2119
2119
** [ ⬆ 返回顶部] ( #代码整洁的-javascript ) **
2120
2120
2121
2121
2122
- ### Function callers and callees should be close
2122
+ ### 函数的调用方与被调用方应该靠近
2123
2123
If a function calls another, keep those functions vertically close in the source
2124
2124
file. Ideally, keep the caller right above the callee. We tend to read code from
2125
2125
top-to-bottom, like a newspaper. Because of this, make your code read that way.
2126
2126
2127
- ** Bad:**
2127
+ 如果一个函数调用另一个, 则在代码中这两个函数的竖直位置应该靠近。 理想情况下,保持被调用函数在被
2128
+ 调用函数的正上方。 我们倾向于从上到下阅读代码, 就像读一章报纸。 由于这个原因, 保持你的代码可
2129
+ 以按照这种方式阅读。
2130
+
2131
+ ** 不好的:**
2128
2132
``` javascript
2129
2133
class PerformanceReview {
2130
2134
constructor (employee ) {
@@ -2163,7 +2167,7 @@ const review = new PerformanceReview(user);
2163
2167
review .perfReview ();
2164
2168
```
2165
2169
2166
- ** Good ** :
2170
+ ** 好的: **
2167
2171
``` javascript
2168
2172
class PerformanceReview {
2169
2173
constructor (employee ) {
You can’t perform that action at this time.
0 commit comments