原型链和new

http://www.cnblogs.com/objectorl/archive/2010/01/11/Object-instancof-Function-clarification.html

原型链和new

构造器(自定义的或者系统默认的)是Function方法构造而出的,所以 function Foo() {};  var ifoo = new Foo();

//      __proto__                       __proto__                           __proto__
// foo -----------> Foo.prototype -----------> Object.prototype -----------> null

// But foo is not an instance of Function, because
// we could not find Function.prototype in foo's
// prototype chain.

Foo instanceof Function;//true    

ifoo instanceof Function;//false

Foo instanceof Object//true

ifoo instanceof Object//true

http://www.ibm.com/developerworks/cn/web/1306_jiangjj_jsinstanceof/

上一篇:Java 获取当前线程、进程、服务器ip


下一篇:Sphinx安装流程及配合PHP使用经验