$(function () {
var userNameAlter=createPopup("alert","验证");
});
function createPopup(type,text){
var o=new Object();
o.content=text;
o.show=function () {
alert("显示");
}
if(type=="alert"){
o.show();
}
if(type=="promot"){
}
if(type=="confirm"){
}
return o;
}
通过寄生式继承得到纯净的对象,虽然这个模式有很多的不足
来源:CSDN
作者:半仙code
链接:https://blog.csdn.net/liz9411/article/details/103608485