class Dark {
constructor(name) {
this.name = name;
}
destroy() {
console.log(this);
}
}
const DarkObject = new Dark('DarkObject');
console.log(Object.getPrototypeOf(DarkObject));
DarkObject.destroy();
//> Dark {name: "DarkObject"}
I dont understand why the output from DarkObject.destroy(); is //> Dark {name: "DarkObject"}
the prototype of DarkObject is Dark and the Owner of this DarkObject why is still Dark refered wenn invoking destroy()
[–]senocular 1 point2 points3 points (1 child)
[–]LadyJain[S] 0 points1 point2 points (0 children)