摘要: 通过ECMAScript 3创建的属性都是可写的、可枚举的、可配置的。在ECMAScript 5中,数据属性的4个特性分别是它的值、可写性、可枚举性、可配置性。存取器属性的特性是读取、写入、可枚举性、可配置性。Object.getOwnPropertyDescriptor("p",x);//查询p对... 阅读全文
posted @ 2015-11-30 16:27 Rella 阅读(191) 评论(0) 推荐(0)
摘要: getter和setter属性:var p = { x:1.0, y:1.0, get r(){ return Math.sqrt(this.x*this.x + this.y * this.y); }, set r(newValue){ v... 阅读全文
posted @ 2015-11-30 15:29 Rella 阅读(176) 评论(0) 推荐(0)