标签:asc config Speak com rip als TE es5 UNC
var a= {} Object.defineProperty(a,"b",{ value:123, writable:false, enumerable:false, configurable:false }) console.log(a.b);//123
var a= {} Object.defineProperty(a,"b",{ set:function(newValue){ console.log("你要赋值给我,我的新值是"+newValue) }, get:function(){ console.log("你取我的值") return 2 //注意这里,我硬编码返回2 } }) a.b =1 //打印 你要赋值给我,我的新值是1 console.log(a.b) //打印 你取我的值 //打印 2 注意这里,和我的硬编码相同的
link:https://www.cnblogs.com/weiqu/p/5860945.html || http://speakingjs.com/es5/ch17.html
标签:asc config Speak com rip als TE es5 UNC
原文地址:https://www.cnblogs.com/Longhua-0/p/9194303.html