Considering the fallowing example :
function A(obj) {
}
B.prototype = new A;
B.prototype.constructor = B;
function B(obj) {
A.call(this, obj);
}
where B should inherit the prototype from A. Is this code correct? Why is it that the function A is called once when the script is parsed, without any instance from A or B being declared? Is it because of the fallowing line?
B.prototype = new A;
If so, how can B inherit A without calling function A in the definition.