Skip to content

Commit c905bda

Browse files
authored
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 parent dcb9d87 commit c905bda

File tree

1 file changed

+3
-1
lines changed
  • 1-js/09-classes/03-static-properties-methods

1 file changed

+3
-1
lines changed

1-js/09-classes/03-static-properties-methods/article.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ User.staticMethod(); // true
1919

2020
That actually does the same as assigning it as a property directly:
2121

22-
```js
22+
```js run
2323
class User() { }
2424

2525
User.staticMethod = function() {
2626
alert(this === User);
2727
};
28+
29+
User.staticMethod(); // true
2830
```
2931

3032
The value of `this` in `User.staticMethod()` call is the class constructor `User` itself (the "object before dot" rule).

0 commit comments

Comments
 (0)