![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
javaScript 面向对象编程随书笔记
代码-君
这个作者很懒,什么都没留下…
展开
-
6.1.1 继承
function Shape(){ this.name = "shape"; this.toString = function(){return this.name}; } function TwoDShape(){ this.name = "2D shape"; } function Triangle(side,height){ this.name = "转载 2014-01-13 09:37:52 · 452 阅读 · 0 评论 -
6.1.2将共享属性迁移到原型中去
function Shape(){}; Shape.prototype.name = "shape"; Shape.prototype.toString = function(){return this.name;}; function TwoDShape(){}; TwoDShape.prototype = new Shape(); TwoDShape.prototy转载 2014-01-13 10:22:33 · 450 阅读 · 0 评论 -
6.2只继承于原型和构造器new F()
function Shape(){}; Shape.prototype.name = "shape"; Shape.prototype.toString = function(){return this.name;}; function TwoDShape(){}; TwoDShape.prototype = Shape.prototype; //TwoDShape.prot转载 2014-01-13 11:07:08 · 521 阅读 · 0 评论 -
6.8 深拷贝
/* 第一次调用传入一个参数parent对象,函数有两个参数,多出来的参数为空即c为空, 递归调用遍历 numbers:[1,2,2], letter:["a","b","c"],转载 2014-03-16 09:54:18 · 352 阅读 · 0 评论