function Base() { // private attribute var i = 2; // public attribute this.k = 3; // private method function setI(j) { i = j; } // public method this.resetI = function() { setI(0); }; // public method this.getI = function() { return i; } } // public attribute Base.prototype.j = 1; // static attribute Base.l = 4; // public method Base.prototype.getJ = function() { return this.j; }; // static method Base.setL = function(m) { Base.l = m; } |
转自:http://sinkiangcai.blog.163.com/blog/static/77664420084702020485/