mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 21:38:03 -05:00
put the dot with fn name when chaining
This commit is contained in:
11
README.md
11
README.md
@@ -814,12 +814,21 @@
|
||||
})(this);↵
|
||||
```
|
||||
|
||||
- Use indentation when making long method chains.
|
||||
- Use indentation when making long method chains. Use a leading dot, which
|
||||
emphasizes that the line is a method call, not a new statement.
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
$('#items').find('.selected').highlight().end().find('.open').updateCount();
|
||||
|
||||
// bad
|
||||
$('#items').
|
||||
find('selected').
|
||||
highlight().
|
||||
end().
|
||||
find('.open').
|
||||
updateCount();
|
||||
|
||||
// good
|
||||
$('#items')
|
||||
.find('.selected')
|
||||
|
||||
Reference in New Issue
Block a user