From 29c4fc680eb2c785265dd3283a381aacb3f6e4d6 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Wed, 6 Nov 2019 20:37:01 +0300 Subject: [PATCH] closes #1589 --- 1-js/09-classes/03-static-properties-methods/article.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/1-js/09-classes/03-static-properties-methods/article.md b/1-js/09-classes/03-static-properties-methods/article.md index fc193e70..4ed0342e 100644 --- a/1-js/09-classes/03-static-properties-methods/article.md +++ b/1-js/09-classes/03-static-properties-methods/article.md @@ -123,14 +123,15 @@ That is the same as a direct assignment to `Article`: Article.publisher = "Ilya Kantor"; ``` -## Inheritance of static methods +## Inheritance of static properties and methods -Static methods are inherited. +Static properties and methods are inherited. -For instance, `Animal.compare` in the code below is inherited and accessible as `Rabbit.compare`: +For instance, `Animal.compare` and `Animal.planet` in the code below are inherited and accessible as `Rabbit.compare` and `Rabbit.planet`: ```js run class Animal { + static planet = "Earth"; constructor(name, speed) { this.speed = speed; @@ -167,6 +168,8 @@ rabbits.sort(Rabbit.compare); */!* rabbits[0].run(); // Black Rabbit runs with speed 5. + +alert(Rabbit.planet); // Earth ``` Now when we call `Rabbit.compare`, the inherited `Animal.compare` will be called.