Created
          August 3, 2015 10:32 
        
      - 
      
 - 
        
Save adnasa/d5d81e0f534e73506c6b to your computer and use it in GitHub Desktop.  
    js prototypal inheritance mindfuck
  
        
  
    
      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
    
  
  
    
  | function Person(name) { | |
| this.name = name; | |
| this.someArray = []; | |
| } | |
| Person.prototype.someArray2 = []; | |
| var adnan = new Person('adnan'); | |
| adnan.someArray.push('something1'); | |
| adnan.someArray2.push('something2'); | |
| var marco = new Person('marco'); | |
| marco.someArray.push('something3'); | |
| marco.someArray2.push('something4'); | |
| console.log(adnan.someArray, adnan.someArray2); | |
| console.log(marco.someArray, marco.someArray2); | 
  
    
      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
    
  
  
    
  | ["something1"] ["something2", "something4"] | |
| ["something3"] ["something2", "something4"] | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
javascript, you're drunk. go home.