博文

目前显示的是标签为“private variable”的博文

private variables in javascript

 (function(window){      //private variables     var name = "test";         var pieAGSI = function(){};     // get variable     pieAGSI.prototype.getName = function(){         return name;     };         // update variable     pieAGSI.prototype.setName = function(str){         name = str;     };         window.pieAGSI = pieAGSI;     })(window); // test var test = new pieAGSI(); document.write('<br>test.getName(): ' + test.getName()+"<br>");