JSFiddle - React, Tailwind, and code Playground
by core972
JavaScript
class okaTree {
constructor(type){
this.type = type;
}
view(val) {
console.log("view", val, this.type);
}
}
let tree = new okaTree("normal");
tree.view("i");
class okaTree2 extends okaTree {
constructor(type){
super(type);
}
modify(val) {
console.log("modify", val, this.type);
}
}
tree = okaTree2;
const myTree = new tree("admin");
myTree.view("j");
myTree.modify("k");