Menu
Hi,
Recently I started working with the prototype property of functions, and running the following code I found a problem
[CODE]function p(param) {
this.y = param;
}
function f(param) {
this.x = param;
}
f.prototype = new p(2);
var obj = new f(1);
alert(f.prototype.constructor);
alert(obj.constructor);
I don´t know why a get the same result in both alerts. I mean, the second one tells me the obj constructor is p, instead of f, as I suppose it should be. Does anyone know why?
Thanks in advance.