Merge pull request #1585 from lumosmind/patch-31

not proved features of class properties
This commit is contained in:
Ilya Kantor 2019-11-06 21:34:25 +03:00 committed by GitHub
commit 7c691b48c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -318,6 +318,9 @@ class User {
}
new User().sayHi();
alert(User.prototype.sayHi); // placed in User.prototype
alert(User.prototype.name); // undefined, not placed in User.prototype
```
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.