Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. var Person = (function () {
  2. // constructor
  3. function Person(name) {
  4. this.name = name;
  5. alert(this.getName());
  6. }
  7.  
  8. // instance methods
  9. Person.prototype = {
  10. // public
  11. getName: function () {
  12. return this.name;
  13. },
  14. // "private" (we are all adults here....)
  15. _private: function () {
  16.  
  17. }
  18. };
  19.  
  20. // class method
  21. Person.blah = function () { alert('blah')}
  22.  
  23. return Person;
  24. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement