From c905bda88a691ed51f3ee3c1040bc38eeb960f1e Mon Sep 17 00:00:00 2001 From: Mustafa Kemal Tuna <12192118+lumosmind@users.noreply.github.com> Date: Tue, 5 Nov 2019 21:06:45 +0300 Subject: [PATCH] prove of concept there is an example code but it doesn't prove anything. But it was created to show that : "That actually does the same as assigning it as a property directly:" --- 1-js/09-classes/03-static-properties-methods/article.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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..c9875ef8 100644 --- a/1-js/09-classes/03-static-properties-methods/article.md +++ b/1-js/09-classes/03-static-properties-methods/article.md @@ -19,12 +19,14 @@ User.staticMethod(); // true That actually does the same as assigning it as a property directly: -```js +```js run class User() { } User.staticMethod = function() { alert(this === User); }; + +User.staticMethod(); // true ``` The value of `this` in `User.staticMethod()` call is the class constructor `User` itself (the "object before dot" rule).