You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
functionobjectFactory(func){varobj={};if(typeoffunc!=="function")returnobj;varret=func.apply(obj,[].slice.call(arguments,1));// 考虑构造函数有返回值的情况// 当返回的是引用类型的时候,会覆盖 new 创建的对象if(typeofret==="function"||typeofret==="object"){returnret;}obj.__proto__=func.prototype;returnobj;}functionfunc(name,age){this.name=name;this.age=age;}func.prototype.showAge=function(){console.log(this.age);}
# new
# Polyfill
# Test
# Reference
mqyqingfeng/Blog#13
The text was updated successfully, but these errors were encountered: