This morning I was reading this web site, about getters and setters in JavaScript, and here I want to copy / paste code which I saw there:
function wrapValue(_value) { return { get value() { return _value; }, set value(newValue) { _value = newValue; } }; } var x = wrapValue(5); console.log(x.value); // output 5 x.value = 7; console.log(x.value); // output 7