I'm new for OOPS JavaScript. Be clear. See my JavaScript code here,
function a(){
this.first = "Kar";
}
function b(){
this.last = "Sho";
}
function c(){
this.getName = function(){
return this.first+this.last;
}
}
c.prototype.u = new a();
c.prototype.v = new b();
var d = new c();
alert(d.getName());
Here, I'm getting following output,
NaN
But I want to print KarSho. Where is problem?
I know following method,
b.prototype = new a();
c.prototype = new b();
Actually what I want is, just call a and b in c. That's it.