Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Daniel Trebbien

By: a guest on May 26th, 2010  |  syntax: JavaScript  |  size: 0.40 KB  |  views: 57  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. };