Skip to content

Commit 33363af

Browse files
author
Jake Teton-Landis
committed
put the dot with fn name when chaining
1 parent 3c68fc4 commit 33363af

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,12 +814,21 @@
814814
})(this);↵
815815
```
816816

817-
- Use indentation when making long method chains.
817+
- Use indentation when making long method chains. Use a leading dot, which
818+
emphasizes that the line is a method call, not a new statement.
818819

819820
```javascript
820821
// bad
821822
$('#items').find('.selected').highlight().end().find('.open').updateCount();
822823
824+
// bad
825+
$('#items').
826+
find('selected').
827+
highlight().
828+
end().
829+
find('.open').
830+
updateCount();
831+
823832
// good
824833
$('#items')
825834
.find('.selected')

0 commit comments

Comments
 (0)