JSFiddle - React, Tailwind, and code Playground
by hyperthalamus
HTML
<div id="test"></div>
JavaScript
var proto;
function testClass(){
this.id = "testClass";
}
proto = testClass.prototype;
proto.id = "";
proto.testMethodOne = function(){
$("#test").append("<p>Test Method One called from " + this.id + "</p>");
}
function testClassTwo(){
this.id = "testClassTwo";
this.subClass = new testClass();
}
proto = testClassTwo.prototype;
proto.id = "";
proto.subClass = new testClass();
proto.testMethodOne = function(){
$("#test").append("<p>Test Method One called from " + this.id + "</p>");
}
proto.testMethodTwo = function(){
$("#test").append("<p> calling subclass method</p>");
this.subClass.testMethodOne();
var myNewFunction = this.subClass.testMethodOne;
myNewFunction();
this.myNewFunction = this.subClass.testMethodOne;
this.myNewFunction();
}
$(function(){
var test2 = new testClassTwo();
test2.testMethodOne();
test2.testMethodTwo();
})