Вот, навскидку:
Object.prototype.key = (function(){
var storage = [], _undefined;
return function(value){
if(value!=_undefined){
for(var i=0; i<storage.length; i++)
if(storage[i].object==this){
storage[i].value = value;
return value;
}
storage.push({object:this,value:arguments[0]});
return value;
}
for(var i=0; i<storage.length; i++) if(storage[i].object==this) return storage[i].value;
return _undefined;
}
}())
var FirstObject = {}, SecondObject = {};
FirstObject.key(100);
SecondObject.key(999);
alert([FirstObject.key(), SecondObject.key()]);