JSFiddle - React, Tailwind, and code Playground
by Researcher
JavaScript
var messageList="";
var cls = function(){
messageList="";
}
var a = {
x: 10,
calculate: function (z) {
return this.x + this.y + z
}
};
var b = {
y: 20,
__proto__: a
};
var c = {
y: 30,
__proto__: a
};
cls();
// вызываем унаследованный метод
log(b.calculate(30)); // 60
log(c.calculate(40)); // 80
function log(theMess){
messageList = messageList + "<br/>" + theMess;
document.write(messageList);
}