SHARE
TWEET

Daniel Trebbien

a guest May 26th, 2010 57 Never
  1. Model.Foo = function() {
  2.     // private stuff
  3.     var a, b;
  4.  
  5.     // method which accesses the variable `a`
  6.     this.func = function() {
  7.         window.alert(a);
  8.     };
  9.  
  10.     // public properties
  11.     this.attr1 = '';
  12.     this.attr2 = '';
  13. };
  14.  
  15. Model.Foo.prototype = {
  16.     func1 : function() { /* ... */},
  17.     func2 : function() { /* ... */}
  18.     //,other prototype functions
  19. };
RAW Paste Data
Top