I was learning about constructors, and I came across the new
keyword.
var obj = new myContructor();
I learnt that it created a new object, set its prototype as constructor.prototype
, set its properties as according with the this
keyword, and finally returns that object.
Now, I am confused as to where exactly does it create the new object, as inside memory or somewhere where it is volatile.
And what do we mean when saying it RETURNS that object, that it creates a copy of the new object at the location of the var obj, or does it reference obj to wherever it created the new object ?