Understanding this
in different context
In constructor
① The new object is used as the this
binding for the function call, so that we
could add key-value pair like this.name = "abc"
and the new object has been linked to the function’s prototype.
new
operator turns function call into aconstructor
call which returns a new object;
② No return statement, constructor automatically return this;
③ Explicitly return an object. We will lost the newly created object with abc,1234, because no reference to it.
But return another object is not commonly usage.
④ In development environment, return Proxy
to alert users when then use object incorrectly.
⑤ Return anything else in constructor, JavaScript engine will ignore it but return the newly created object.