2013年3月6日
摘要: JavaScript中instanceof对于不同的构造器可能都返回true我们知道 instanceof 运算符用来检查对象是否为某构造器的实例。下面列举它返回true的各种情景。1、对象obj是通过new Constructor创建的,那么 obj instanceof Constructor 为true?123456function Person(n, a) { this.name = n; this.age = a;}var p = new Person('John Backus', 82);console.log(p instanceof Person); // tr 阅读全文
posted @ 2013-03-06 21:26 tware_dsy 阅读(189) 评论(0) 推荐(0)