JSFiddle - React, Tailwind, and code Playground

by vickaita

JavaScript

var a = {};

Object.defineProperty(a, "foo", {
    get: function() {
        return this._foo;
    },
    set: function(x) {
        this._foo = x;
        console.log('foo set', x);
    },
    configurable: false
});

var b = Object.create(a);
b.foo = 10;


b.foo = function () { return 5; };