Merge pull request #274 from tomekwi/paren-whitespace

Specify whitespace rules for parentheses
This commit is contained in:
Harrison Shoff
2015-04-02 09:09:46 -07:00

View File

@@ -803,6 +803,30 @@
});
```
- Place 1 space before the opening parenthesis in control statements (`if`, `while` etc.). Place no space before the argument list in function calls and declarations.
```javascript
// bad
if(isJedi) {
fight ();
}
// good
if (isJedi) {
fight();
}
// bad
function fight () {
console.log ('Swooosh!');
}
// good
function fight() {
console.log('Swooosh!');
}
```
- Set off operators with spaces.
```javascript