Skip to content

Instantly share code, notes, and snippets.

@DavidBruant
Created April 6, 2011 07:59
Show Gist options
  • Save DavidBruant/905301 to your computer and use it in GitHub Desktop.
Save DavidBruant/905301 to your computer and use it in GitHub Desktop.
C instances communicating with each other
"use strict";
var getInstance = (function(){
var p = Object.create(null);
return function(){
return Object.create(p);
};
})();
var c1 = getInstance();
var c2 = getInstance();
Object.getPrototypeOf(c1).c = 5;
console.log(c2.c); // 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment