JSFiddle - React, Tailwind, and code Playground
by jrunning
JavaScript
var test = function () {}
Object.defineProperty(test.prototype, 'prop', {
get: function () { return this._prop; },
set: function (val) { return this._prop = val * 2; }
});
var obj = new test;
document.write(obj.prop = 1); document.write("<br/>");
document.write(obj.prop);