File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
1-js/04-object-basics/06-constructor-new Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -148,10 +148,10 @@ function BigUser() {
148
148
149
149
this .name = " John" ;
150
150
151
- return { name: " Godzilla" }; // <-- returns an object
151
+ return { name: " Godzilla" }; // <-- returns this object
152
152
}
153
153
154
- alert ( new BigUser ().name ); // Godzilla, got that object ^^
154
+ alert ( new BigUser ().name ); // Godzilla, got that object
155
155
```
156
156
157
157
And here's an example with an empty ` return ` (or we could place a primitive after it, doesn't matter):
@@ -161,7 +161,7 @@ function SmallUser() {
161
161
162
162
this .name = " John" ;
163
163
164
- return ; // finishes the execution, returns this
164
+ return ; // <-- returns this
165
165
}
166
166
167
167
alert ( new SmallUser ().name ); // John
You can’t perform that action at this time.
0 commit comments