随笔分类 - js面向对象
摘要:1、构造器工作模式——原型链法: Child.prototype = new Parent(); //Child.prototype.constructor改变了,成为Parent Child.prototype.constructor = Child; 2、构造器工作模式——仅从原型链继承法(速度
阅读全文
摘要:1、hasOwnProperty():判断属性是不是自身属性,是返回true=>对象.hasOwnProperty(属性) in:自身和原型都返回true =>属性 in 对象 因此通过以上属性,就可以判断是存在对象中?还是原型中? 一些对比,如下: 2、propertyIsEnumerable()
阅读全文

浙公网安备 33010602011771号