<script>var DED = function() { var pvar=3; function private_method() { // do stuff here
pvar = 5;
} return {
method_1 : function() { // do stuff here
private_method();
alert(pvar);
pvar = 6;
},
method_2 : function() { // do stuff here
alert(pvar);
}
};
}();
DED.method_1();
DED.method_2();</script>
很容易理解的js對象代碼模版, 只是不知道如何克隆一個新的對象
小唯快跑啊
2018-08-10 10:09:15