While trying to port and generally playing around with some non-browser code, I came across getters and setters that looked like normal object properties. Something like this:
js> var o = {
a: 4,
get b(){
return this.a + 3;
},
set b(val){
this.a = val - 3;
}
};
js> o.a
4
js> o.b
7
js> o.b=10
10
js> o.a
7
This seems to work in recent versions of Rhino and Spidermonkey, but is it possible to implement or simulate the behavior (the defining syntax is less important to me) in JScript (Windows Script Host)?