mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 19:38:05 -05:00
add else to docs
This commit is contained in:
23
README.md
23
README.md
@@ -637,6 +637,29 @@
|
||||
}
|
||||
```
|
||||
|
||||
- If you're using multi-line blocks with `if` and `else`, put `else` on the same line as your
|
||||
`if` block's closing brace.
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
if (test) {
|
||||
thing1();
|
||||
thing2();
|
||||
}
|
||||
else {
|
||||
thing3();
|
||||
}
|
||||
|
||||
// good
|
||||
if (test) {
|
||||
thing1();
|
||||
thing2();
|
||||
} else {
|
||||
thing3();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
**[⬆ back to top](#table-of-contents)**
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user