const obj = {};
obj.x = 3;
console.log(obj.x); // Prints 3.
console.log(obj); // Prints { x: 3 }.
const key = "y";
obj[key] = 5;
console.log(obj[key]); // Prints 5.
console.log(obj); // Prints { x: 3, y: 5 }.
And is the obj[key].
Just giving some names to find the relations of that nomenclature, so we have the obj.x let call the 'x' parent, and the obj.y would be that way the 'y' is the relative and the obj[key] let call 'key' ancestor, so that concludes that obj.y have an ancestor and the obj.x doesn't have an ancestor so doesn't have that way of representation that have the obj.y that is obj[key]. Rute Bezerra de Menezes Gondim
No comments:
Post a Comment