Last active
          December 17, 2015 02:48 
        
      - 
      
 - 
        
Save erikroyall/5538077 to your computer and use it in GitHub Desktop.  
    JavaScript Private Properties and Methods in Object- Oriented Programming
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | window.erik = (function(){ | |
| var Erik, erik; | |
| Erik = function() { | |
| this.name = "Erik Royall"; | |
| this.age = 14; | |
| }; | |
| return erik = { | |
| // Public Method | |
| getName: function() { | |
| var e = new Erik(); | |
| return e.name; | |
| } | |
| }; | |
| }()); | |
| console.log(erik.getName()); // "Erik Royall" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment