JavaScript must inherit the of 7js object

  • 2021-06-28 10:05:46
  • OfStack

Object inherits inherit


var o = { r: };
var c = function f() {
};
c.prototype = o;
c.r = ;
alert(o.r);// The inherited property value has not changed. 
alert(c.r);//c in r Covered o Properties in.

How do I call the r property in o?


var o = { r: };
var c = function f() {
};
c.prototype = o;
alert(o.r);//  The inherited property value has not changed. 
alert(c.r);// query r Property, return undefined Value. 
alert(c.prototype.r);// c in r Covered o Properties in.  

Calls should be made using prototypes.


Related articles: