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
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ The notation here is not to be confused with object literals. Within the class,
64
64
65
65
## What is a class?
66
66
67
-
So, what exactly is a `class`? That's not an entirely new language-level entity, as one might think.
67
+
So, what exactly is a `class`? That's not an entirely new language-level entity, as one might think.
68
68
69
69
Let's unveil any magic and see what a class really is. That'll help in understanding many complex aspects.
70
70
@@ -91,7 +91,7 @@ What `class User {...}` construct really does is:
91
91
92
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 `new User` object has access to class methods.
93
93
94
-
We can illustrate the result of `class User` as:
94
+
We can illustrate the result of `class User`declaration as:
95
95
96
96

97
97
@@ -198,7 +198,8 @@ Similar to Named Function Expressions, class expressions may or may not have a n
198
198
If a classexpression has a name, it's visible inside the class only:
199
199
200
200
```js run
201
-
// "Named Class Expression" (alas, no such term, but that's what's going on)
201
+
// "Named Class Expression"
202
+
// (no such term in the spec, but that's similar to Named Function Expression)
202
203
let User =class*!*MyClass*/!* {
203
204
sayHi() {
204
205
alert(MyClass); // MyClass is visible only inside the class
@@ -268,7 +269,7 @@ alert(user.name); // John
268
269
user =newUser(""); // Name too short.
269
270
```
270
271
271
-
Internally, getters and setters are created on`User.prototype`, like this:
272
+
The class declaration creates getters and setters in`User.prototype`, like this:
0 commit comments