Posted By

devnull69 on 07/01/11


Tagged

class object prototype private public


Versions (?)

Classes objects prototype and static


 / Published in: JavaScript
 

  1. // class
  2. var myClass = function(param) {
  3. // private member
  4. var myMember = param;
  5. // private method
  6. var myMethod = function(whatever) {
  7.  
  8. };
  9.  
  10. //public member
  11. this.myPublic = 7;
  12. // public method
  13. this.myPublicMethod = function(whatelse) {
  14.  
  15. };
  16. };
  17.  
  18. // prototype (public)
  19. myClass.prototype.myNewMember = 7;
  20. myClass.prototype.myNewMethod = function() {};
  21.  
  22. // static
  23. myClass.myStatic = 8;
  24.  
  25. // object
  26. var myObject = new myClass(7);

Report this snippet  

You need to login to post a comment.