JSFiddle - React, Tailwind, and code Playground
JavaScript
function test() {
this._webGLVersion = 2;
}
Object.defineProperty(test.prototype, "version", {
/**
* Returns the version of the engine
*/
get: function () {
console.log("I have been called with scope ", this);
return this._webGLVersion;
},
enumerable: false,
configurable: true
});
console.log("first test", test.prototype.version);
console.log("second test", new test().version);