Merge pull request #1588 from lumosmind/patch-36

prove of concept
This commit is contained in:
Ilya Kantor 2019-11-06 20:50:39 +03:00 committed by GitHub
commit 763a639323
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).