var module1 = (function () { var count = 0; var setcount = function (val) { count = val; }; var getcount = function () { alert("count=" + count); }; return { count: count, getcount: getcount, setcount: setcount }; })(); module1.count = 100; module1.getcount(); //0 alert(module1.count); //100 module1.setcount(200); module1.getcount(); //200 alert(module1.count); //100
本人前端薄弱,不明白为什么module1.count设置的不是module1内部count的值,请指点!或给出博文参考也行。谢谢!
烙印99
相关分类