function new2(){
var obj = {};
var Constructor = [].shift.call(arguments);//拿到待传入的构造函数
obj._proto_ = Constructor.prototype;
var result = Constructor.apply(obj,arguments);
return typeof result === "object" ? result : obj ;
}
//演示效果
function a(){
this.x = '111'
};
var b = new2(a);
b.x //"111"
网友评论