minor
This commit is contained in:
parent
5c8d24a582
commit
2d3f7cc7ce
1 changed files with 3 additions and 3 deletions
|
@ -148,10 +148,10 @@ function BigUser() {
|
|||
|
||||
this.name = "John";
|
||||
|
||||
return { name: "Godzilla" }; // <-- returns an object
|
||||
return { name: "Godzilla" }; // <-- returns this object
|
||||
}
|
||||
|
||||
alert( new BigUser().name ); // Godzilla, got that object ^^
|
||||
alert( new BigUser().name ); // Godzilla, got that object
|
||||
```
|
||||
|
||||
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() {
|
|||
|
||||
this.name = "John";
|
||||
|
||||
return; // finishes the execution, returns this
|
||||
return; // <-- returns this
|
||||
}
|
||||
|
||||
alert( new SmallUser().name ); // John
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue