daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function foo(){};
  2. foo.prototype.a = 1;
  3. foo.prototype.f = function(){ return this.a; }
  4. var c=new foo(); c.__proto__.a++;
  5. var d=new foo(); d.a++;
  6. console.log(d.f(), d.a, d.__proto__.a);
  7.  
  8.  
  9. vs
  10.  
  11. function foo(){};
  12. foo.prototype.a = 1;
  13. foo.prototype.f = function(){ return this.a; }
  14. var c=new foo(); c.__proto__.a++;
  15. var d=new foo(); d.a=6; d.a++;
  16. console.log(d.f(), d.a, d.__proto__.a);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top