Skip to content

Commit a7e2c43

Browse files
committedOct 11, 2019
minor
1 parent 662f519 commit a7e2c43

File tree

1 file changed

+2
-2
lines changed
  • 1-js/08-prototypes/02-function-prototype/4-new-object-same-constructor

1 file changed

+2
-2
lines changed
 

‎1-js/08-prototypes/02-function-prototype/4-new-object-same-constructor/solution.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ alert( user2.name ); // Pete (worked!)
1515

1616
It worked, because `User.prototype.constructor == User`.
1717

18-
..But if someone, so to speak, overwrites `User.prototype` and forgets to recreate `"constructor"`, then it would fail.
18+
..But if someone, so to speak, overwrites `User.prototype` and forgets to recreate `constructor` to reference `User`, then it would fail.
1919

2020
For instance:
2121

@@ -41,4 +41,4 @@ Here's how `new user.constructor('Pete')` works:
4141
2. Then it follows the prototype chain. The prototype of `user` is `User.prototype`, and it also has nothing.
4242
3. The value of `User.prototype` is a plain object `{}`, its prototype is `Object.prototype`. And there is `Object.prototype.constructor == Object`. So it is used.
4343

44-
At the end, we have `let user2 = new Object('Pete')`. The built-in `Object` constructor ignores arguments, it always creates an empty object -- that's what we have in `user2` after all.
44+
At the end, we have `let user2 = new Object('Pete')`. The built-in `Object` constructor ignores arguments, it always creates an empty object, similar to `let user2 = {}`, that's what we have in `user2` after all.

0 commit comments

Comments
 (0)
Please sign in to comment.