Advertisement
Guest User

Untitled

a guest
May 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. var A = function() { console.log("This is Constructor A"); };
  2.  
  3. A.prototype.x = function() { console.log("This is A.prototype.x"); };
  4.  
  5. var B = new A();
  6.  
  7. B.x(); //"This is A.prototype.x"
  8.  
  9. B.__proto__.x = function() { console.log("Edit B.__proto__.x"); };
  10.  
  11. B.x(); //"Edit B.__proto__.x"
  12.  
  13. var C = new A();
  14.  
  15. C.x(); //Edit B.__proto__.x
  16.  
  17. C.__proto__.x = function() { console.log("Edit C.__proto__.x"); };
  18.  
  19. C.x(); //Edit C.__proto__.x
  20.  
  21. B.x(); //Edit C.__proto__.x
  22.  
  23. A.prototype.x(); //Edit C.__proto__.x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement