繁华开满天机
你是说实例化一个类吧,对于用户自定义的类,new f(a, b, c)相当于// Create a new instance using f's prototype.var newInstance = Object.create(f.prototype), result;// Call the functionresult = f.call(newInstance, a, b, c),// If the result is a non-null object, use it, otherwise use the new instance.result && typeof result === 'object' ? result : newInstance答案摘自这里