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:"
This commit is contained in:
Mustafa Kemal Tuna 2019-11-05 21:06:45 +03:00 committed by GitHub
parent dcb9d87ab8
commit c905bda88a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,12 +19,14 @@ User.staticMethod(); // true
That actually does the same as assigning it as a property directly: That actually does the same as assigning it as a property directly:
```js ```js run
class User() { } class User() { }
User.staticMethod = function() { User.staticMethod = function() {
alert(this === User); 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). The value of `this` in `User.staticMethod()` call is the class constructor `User` itself (the "object before dot" rule).