mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 22:38:08 -05:00
Merge pull request #274 from tomekwi/paren-whitespace
Specify whitespace rules for parentheses
This commit is contained in:
24
README.md
24
README.md
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user