Adding comments about spacing between blocks

This commit is contained in:
Eli White
2015-02-07 23:21:58 -08:00
parent 4503923ec5
commit 533e9ea7ba

View File

@@ -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