OOP in JavaScript

Create a custom object in JavaScript
Add a Method in Object
例子

每次JavaScript访问一个对象的属性时,将按这个顺序查询:
1.如果当前对象的属性是个值,要找的就是这个值了。
2.如果当前对象的属性没有值,就查找构造器的所有属性。
3.查找直到找到一个合适的属性(有一个值)。
原文:
If the property has a value assigned to the current (local) object, this is the value to use.
If there is no local value, check the value of the property’s prototype of the object’s constructor.
Continue up the prototype chain until either a match of the property is found (with a value assigned to it) or the search reaches the native Object object. Therefore, if you change the value of a constructor’s prototype property and you do not override the property value in an instance of that constructor, JavaScript returns the current value of the constructor’s prototype property.
Obsever in JavaScript:

Observer
学习原文
posted @ 2006-12-31 13:44  南守拥  阅读(242)  评论(0编辑  收藏  举报