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
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -318,6 +318,9 @@ class User {
318
318
}
319
319
320
320
newUser().sayHi();
321
+
322
+
alert(User.prototype.sayHi); // placed in User.prototype
323
+
alert(User.prototype.name); // undefined, not placed in User.prototype
321
324
```
322
325
323
326
The property `name` is not placed into `User.prototype`. Instead, it is created by `new` before calling the constructor, it's a property of the object itself.
0 commit comments