javascript 对象属性的get set访问器写法
function Person() {
var age =
new
Date().getFullYear() -
18
;
Object.defineProperty(
this
,
"age"
, {
get: function () {
return
age+10; },
set: function (value) { age = value; }
});
}