Xxx.call (thisobj, arg1,...) The call can change the execution environment of the current function as an incoming Thisobj object. This can be achieved by inheriting ———— the current object to get the properties and methods of XXX.
Example:
function Animal () { this.name= ' Animal '; This.say = function () { alert (this.name); } }
Animal.prototype.walk = ' I can walk '; function Duck () { animal.call (this);
/* In this way, an object that has a constructor duck new is implemented that inherits the attribute (name) and method (say) on the animal */
/* But the properties and methods above the animal's prototype are not inherited. */
/* This means that only instance properties are inherited , not prototype properties. */
This.color = ' white ';} var duck = new Duck ();d Uck.say ();//animal
JavaScript inherits instance properties by using call