You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/09-classes/01-class/article.md
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,17 +87,16 @@ alert(typeof User); // function
87
87
What `class User {...}` construct really does is:
88
88
89
89
1. Creates a function named `User`, that becomes the result of the class declaration. The function code is taken from the `constructor` method (assumed empty if we don't write such method).
90
-
2. Stores all methods, such as `sayHi`, in `User.prototype`.
90
+
2. Stores class methods, such as `sayHi`, in `User.prototype`.
91
91
92
-
Afterwards, for new objects, when we call a method, it's taken from the prototype, just as described in the chapter <info:function-prototype>. So a `new User` object has access to class methods.
92
+
Afterwards, for `new User`objects, when we call a method, it's taken from the prototype, just as described in the chapter <info:function-prototype>. So the object has access to class methods.
93
93
94
94
We can illustrate the result of `class User` declaration as:
0 commit comments