What exactly does the new operator in JS do
Ex. :
var obj = new Base()
Copy the code
-
First it creates an empty object: var obj = {}
-
Null object inheritance constructor prototype: obj.__proto__ = base.prototype
-
Refer Base this to obj: base.call (obj)