プロパティ

Firefoxの拡張のソースを眺めてて、なんとなく気になった。
Firefox独自かなぁ…Rhinoでは使えなかったけど。


<html>
<head>
<script>
var o = {
_foo: 10,
get foo() {
return this._foo;
},
set foo(x) {
this._foo = x;
}
};
</script>
</head>
<body>
<input type="button" onClick="alert(o.foo)">
</body>
</html>