This commit is contained in:
Ilya Kantor 2017-09-25 00:36:24 +03:00
parent 862075a6bc
commit 807f0d8b2d
2 changed files with 17 additions and 13 deletions

View file

@ -10,9 +10,11 @@ But in the old times, there was another (and the only) way to set it: to use a `
## The "prototype" property
As we know already, `new F()` creates a new object. In the process, its "magic" `F.prototype` property is used by the JavaScript itself to set `[[Prototype]]` for new objects.
As we know already, `new F()` creates a new object.
**When a new object is created with `new F()`, the object's `[[Prototype]]` is set to `F.prototype`.**
When a new object is created with `new F()`, the object's `[[Prototype]]` is set to `F.prototype`.
In other words, if `F` has a `prototype` property with a value of the object type, then `new` operator uses it to set `[[Prototype]]` for the new object.
Please note that `F.prototype` here means a regular property named `"prototype"` on `F`. It sounds something similar to the term "prototype", but here we really mean a regular property with this name.