看到一篇文章: Understanding JavaScript OOP - CNode技术社区

看到一篇文章: Understanding JavaScript OOP
发布于 13 年前 作者 jiyinyiyong 5413 次浏览 最后一次编辑是 9 年前

可惜是英文的... 觉得用法好高端啊, 以前学 JS 比较乱, 都没接触到这层, Orz http://killdream.github.com/blog/2011/10/understanding-javascript-oop/

Object.defineProperty(mikhail, 'name', { value: 'Mikhail'
 , writable: true
 , configurable: true
 , enumerable: true })
Object.defineProperty(mikhail, 'age', { value: 19
 , writable: true
 , configurable: true
 , enumerable: true })
Object.defineProperty(mikhail, 'gender', { value: 'Male'
 , writable: true
 , configurable: true
 , enumerable: true })
7 回复

这是EC-5的用法吧,,低端浏览器不支持啊。。

这个计子在沪js大会上说过

Object.defineProperty(Array.prototype, 'lastItem', {
 'get':function () {
 return this[this.length - 1];
 }
});

这个是我在node里扩展的一个东西.

这是最基本的知识吧......

虽然这么说... 我自学 JS 的, 这个真的每个学完 JS 的人都清晰的么, 我说链接里边的那些...

@jiyinyiyong ES5定义的新标准,可操纵对象的一些接口属性,莫太纠结,ES5的标准还不太普及。

反射不慎太长了... 没去过上海... "计子"原来是缩写是吧...

回到顶部

AltStyle によって変換されたページ (->オリジナル) /