js this keyword

来源:互联网 发布:java中md5加密设置位数 编辑:程序博客网 时间:2024/05/17 22:23

Finally a value is assigned for use with the this keyword. If the value assigned refers to an object then property accessors prefixed with the this keyword reference properties of that object. If the value assigned (internally) is null then the this keyword will refer to the global object.

最后,在this可以被使用之前,还必须先对其赋值。如果赋的值是一个对象的引用,则 this.m 访问的便是该对象上的 m。如果(内部)赋的值是 null,则this就指向全局对象。

refer to

http://www.cn-cuckoo.com/wordpress/wp-content/uploads/2007/08/JavaScriptClosures.html

this 指定当前对象一个对象就是由
一个或多个属性(方法)组成的集合。每个集合元素不是仅能属于一个集合,而是可以动态
的属于多个集合。这样,一个方法(集合元素)由谁调用,this指针就指向谁。实际上,前
面介绍的apply方法和call方法都是通过强制改变this指针的值来实现的,使this指针指向
参数所指定的对象,从而达到将一个对象的方法作为另一个对象的方法运行的效果。

refer to

http://hi.baidu.com/dp_vance/blog/item/b9c80bfb76bf0a264f4aea86.html

function foo()内的this.abc与function foo()外的foo.prototype.abc等价 function foo()内的foo.abc与function foo()外的foo.abc等价,function foo()内的this.abc和foo.abc存在时不再取function foo()外的等价属性。

先写到这,请大家指点。

javascript静态方法属性对象,非静态方法属性,有人说关于静态方法你对js的理解本身就是错误的,更让我惊讶的是到处都是这样错误的写法”待修正

refer to

http://blog.tugai.net/2009/03/07/javascript-static-class-mothed-property/

 

 

/////http://hi.baidu.com/pop123shen/blog/category/Js%20This