It is hard to describe the situation without code. My modification made some answers irrelevant. I past the original code here and simplified version below:
function Entity(){
var value = {};
return {
'value': value
};
}
var e1 = Entity();
var e2 = Entity();
alert(e1.value === e2.value);
I thought it should return true. But in fact, it returns false. Is 'value' copied when it is returned from the function Entity?
update I think I know the reason now. each time Entity function is called the expression "var value={};" will generate a new Object. Thanks.