I just asked this question How to clone an object in javascript?
And I had another question. When I create an object from another with Object.create
, the __proto__
attribute containing the contents of the object passed by the create
argument is added to the new object.
So:
function writeObject(obj)
{
document.write(JSON.stringify(obj));
}
a = {nome: 'wallace'}
b = Object.create(a);
writeObject(a);
writeObject(b);
writeObject(b.__proto__);
What does this __proto__
mean?