diff --git a/README.md b/README.md index 3b173dd385..ea8296a4b4 100644 --- a/README.md +++ b/README.md @@ -1110,6 +1110,8 @@ Other Style Guides - [9.3](#constructors--chaining) Methods can return `this` to help with method chaining. + + > When? Use chaining when functions manipulate the internals of an object instead of just returning data. ```javascript // bad @@ -1141,8 +1143,9 @@ Other Style Guides const luke = new Jedi(); - luke.jump() - .setHeight(20); + luke.jump() + .setHeight(20); // same as var tmp = luke.jump(); tmp.setHeight(20); + // executes left to right. First jump() and then setHeight() ```