From 49aef002350ea9ecac9b77fc3ba8253f3b6d3802 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Mon, 20 May 2019 10:09:38 +0300 Subject: [PATCH] fixes --- .../04-private-protected-properties-methods/article.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1-js/09-classes/04-private-protected-properties-methods/article.md b/1-js/09-classes/04-private-protected-properties-methods/article.md index ea675341..78d6c78f 100644 --- a/1-js/09-classes/04-private-protected-properties-methods/article.md +++ b/1-js/09-classes/04-private-protected-properties-methods/article.md @@ -164,7 +164,7 @@ class CoffeeMachine { } *!*getWaterAmount()*/!* { - return this.waterAmount; + return this._waterAmount; } } @@ -215,7 +215,7 @@ class CoffeeMachine { } get waterAmount() { - return this.waterAmount; + return this._waterAmount; } } @@ -262,7 +262,7 @@ Unlike protected ones, private fields are enforced by the language itself. That' But if we inherit from `CoffeeMachine`, then we'll have no direct access to `#waterAmount`. We'll need to rely on `waterAmount` getter/setter: ```js -class CoffeeMachine extends CoffeeMachine() { +class MegaCoffeeMachine extends CoffeeMachine() { method() { *!* alert( this.#waterAmount ); // Error: can only access from CoffeeMachine