var man={
name:"Bosn",
weibo:'@Bosn',
get age(){
return new Date().getFullYear()-1987;
},
set age(val){
console.log("Age can't be set "+val);
}
}
console.log(man.age);//27
man.age=100;//Age can't be set to 100;
console.log(man.age);//still 27
name:"Bosn",
weibo:'@Bosn',
get age(){
return new Date().getFullYear()-1987;
},
set age(val){
console.log("Age can't be set "+val);
}
}
console.log(man.age);//27
man.age=100;//Age can't be set to 100;
console.log(man.age);//still 27
2015-05-20
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript ( 视频里面介绍的 那个地址打不开了 ,用这个
2015-05-18