Last active
          December 19, 2015 19:48 
        
      - 
      
- 
        Save gecbla/6008374 to your computer and use it in GitHub Desktop. 
    Clone object in JavaScript - prototypal inheritance
  
        
  
    
      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
    
  
  
    
  | /** | |
| * @see http://javascript.crockford.com/prototypal.html | |
| */ | |
| if (typeof Object.create !== 'function') { | |
| Object.create = function(o) { | |
| var F = function() {}; | |
| F.prototype = o; | |
| return new F(); | |
| }; | |
| } | |
| newObj = Object.create(oldObj); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment