When a function is invoked as a constructor with the new keyword this takes the value of the object being constructed
new
this
function Obj(name) { this.name = name; } var obj = new Obj("Foo"); console.log(obj);
This will log
{ name: “Foo” }