In javascript, you can set object property getters like so
const obj = {
get a() {
return 1
}
}
console.log(obj.a) // 1
Is it possible to define a global getter? Something like:
let a = get() { return 1 }
console.log(a) // 1
Or, in the node REPL, obj shows up as: {a: [Getter]}, so is there some sort of constructor I could use: let a = new Getter(() => {return 1})
Also, can I do the same with setters?
