JavaScript Prototype Shared Data
Consider the following:
var User = function(data){
if(data) this.data = data;
};
User.prototype.data = {};
This seems to work well.
var admin = User({id:1});
console.log(admin.data.id) //1
The issue becomes apparent in the following example:
var guest = User();
var admin = User({id:1});
console.log(guest.data.id); //1