2013年2月17日

javascript call函数实现继承时遇到的问题

摘要: javascript中用call函数可以实现继承,但有一个问题需要注意。请看下面代码:// 构造函数 function Person(name, sex) { this.name = name; this.sex = sex; } // 定义Person的原型,原型中的属性可以被自定义对象引用 Person.prototype = { getName: function() { return this.name; }, getSex: function() { return t... 阅读全文

posted @ 2013-02-17 13:21 Mr Code 阅读(1051) 评论(4) 推荐(0) 编辑

导航