From: Asen Bozhilov on
Carlos JP wrote:

> how can i create an object that is the union of the object and the
> function return something like:
>
> var b = a.Join(getDetail()) ??

What is expected value returned by `Join' method? New native object or
will modify the object referred by `a'? One possible approach is to
create new object which has in prototype chain reference to `a' and
augment that object with new properties.

var objectCreate = (function() {
function F(){}
return function(obj) {
F.prototype = obj;
return new F();
};
})();

var person = {
name : "Carlos",
id : 102
};

var personInfo = objectCreate(person);
personInfo.adress = "Portugal";
personInfo.phone = 214443534535;


print(personInfo.name);
print(personInfo.id);
print(personInfo.adress);
print(personInfo.phone);