Function new操作符
2022-07-13 本文已影响0人
JamesSawyer
Function.prototype.new = function new() {
var that = Object.create(this.prototype),
result = this.apply(that, arguments);
return (
typeof result === 'object' && result !== null
) ? result : that;
}