File tree 1 file changed +5
-7
lines changed
1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -1444,13 +1444,11 @@ class Human extends Mammal {
1444
1444
1445
1445
1446
1446
### Use method chaining
1447
- Against the advice of Clean Code, this is one place where we will have to differ.
1448
- It has been argued that method chaining is unclean and violates the [ Law of Demeter] ( https://en.wikipedia.org/wiki/Law_of_Demeter ) .
1449
- Maybe it's true, but this pattern is very useful in JavaScript and you see it in
1450
- many libraries such as jQuery and Lodash. It allows your code to be expressive,
1451
- and less verbose. For that reason, I say, use method chaining and take a look at
1452
- how clean your code will be. In your class functions, simply return ` this ` at
1453
- the end of every function, and you can chain further class methods onto it.
1447
+ This pattern is very useful in JavaScript and you see it in many libraries such
1448
+ as jQuery and Lodash. It allows your code to be expressive, and less verbose.
1449
+ For that reason, I say, use method chaining and take a look at how clean your code
1450
+ will be. In your class functions, simply return ` this ` at the end of every function,
1451
+ and you can chain further class methods onto it.
1454
1452
1455
1453
** Bad:**
1456
1454
``` javascript
You can’t perform that action at this time.
0 commit comments