new模拟实现

来源:互联网 发布:2016年网络大电影数据 编辑:程序博客网 时间:2024/06/07 14:31
function newFactory(){    var obj = new Object();    var args = arguments;    fn = args.shift();    obj.__proto__ = fn.prototype;    var result = fn.call(obj,args);    return typeof result === 'object' ? result : obj;}
原创粉丝点击