mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 19:38:05 -05:00
Adding comments about spacing between blocks
This commit is contained in:
39
README.md
39
README.md
@@ -369,7 +369,7 @@
|
||||
- Use one `var` declaration per variable.
|
||||
It's easier to add new variable declarations this way, and you never have
|
||||
to worry about swapping out a `;` for a `,` or introducing punctuation-only
|
||||
diffs.
|
||||
diffs.
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
@@ -854,6 +854,43 @@
|
||||
.call(tron.led);
|
||||
```
|
||||
|
||||
- Leave a blank line after blocks and before the next statement
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
if (true) {
|
||||
var a = 2;
|
||||
}
|
||||
var b = 3;
|
||||
|
||||
// good
|
||||
if (true) {
|
||||
var a = 2;
|
||||
}
|
||||
var b = 3;
|
||||
|
||||
// bad
|
||||
var o = {
|
||||
foo: function() {
|
||||
},
|
||||
bar: function() {
|
||||
}
|
||||
};
|
||||
return o;
|
||||
|
||||
// good
|
||||
var o = {
|
||||
foo: function() {
|
||||
},
|
||||
|
||||
bar: function() {
|
||||
}
|
||||
};
|
||||
|
||||
return o;
|
||||
```
|
||||
|
||||
|
||||
**[⬆ back to top](#table-of-contents)**
|
||||
|
||||
## Commas
|
||||
|
||||
Reference in New Issue
Block a user