File tree 1 file changed +3
-3
lines changed
1-js/09-classes/03-static-properties-methods
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ rabbits.sort(Rabbit.compare);
169
169
rabbits[0 ].run (); // Black Rabbit runs with speed 5.
170
170
```
171
171
172
- Now when we can call ` Rabbit.compare ` , the inherited ` Animal.compare ` will be called.
172
+ Now when we call ` Rabbit.compare ` , the inherited ` Animal.compare ` will be called.
173
173
174
174
How does it work? Again, using prototypes. As you might have already guessed, ` extends ` gives ` Rabbit ` the ` [[Prototype]] ` reference to ` Animal ` .
175
175
@@ -180,7 +180,7 @@ So, `Rabbit extends Animal` creates two `[[Prototype]]` references:
180
180
1 . ` Rabbit ` function prototypally inherits from ` Animal ` function.
181
181
2 . ` Rabbit.prototype ` prototypally inherits from ` Animal.prototype ` .
182
182
183
- As the result, inheritance works both for regular and static methods.
183
+ As a result, inheritance works both for regular and static methods.
184
184
185
185
Here, let's check that by code:
186
186
@@ -197,7 +197,7 @@ alert(Rabbit.prototype.__proto__ === Animal.prototype); // true
197
197
198
198
## Summary
199
199
200
- Static methods are used for the functionality that belongs to the class "as a whole", doesn't relate to a concrete class instance.
200
+ Static methods are used for the functionality that belongs to the class "as a whole". It doesn't relate to a concrete class instance.
201
201
202
202
For example, a method for comparison ` Article.compare(article1, article2) ` or a factory method ` Article.createTodays() ` .
203
203
You can’t perform that action at this time.
0 commit comments