【发布时间】:2011-09-09 20:26:43
【问题描述】:
我正在研究 node.js 的 Express 框架,所有继承都由以下人员完成:
Collection.prototype.__proto__ = Array.prototype;
那不等于:
Collection.prototype = new Array;
另一个:
var app = HTTPSServer.prototype;
function HTTPSServer(options, middleware){
connect.HTTPSServer.call(this, options, []);
this.init(middleware);
};
app.__proto__ = connect.HTTPSServer.prototype;
这些方法有什么好处吗?
提前致谢!
示例来自:
https://github.com/visionmedia/express/blob/master/lib/router/collection.js
https://github.com/visionmedia/express/blob/master/lib/https.js
【问题讨论】:
标签: javascript node.js express