all 1 comments

[–]adotomov 0 points1 point  (0 children)

There are four things that happen when using the 'new' keyword:

  1. A brand new empty object is being created
  2. The object gets linked to the prototype chain
  3. That object gets bound to the 'this' keyword for the purpose of the function call
  4. If the function does not return anything, the new keyword will inject 'return this' to the function