trying to understand the exact different between using .
and []
to get a value from an object:
const o = {name: "aaa", family: "bbb"};
print(o["name"]);
print(o.name);
Are there any cases that one would be preferable over the other one?
trying to understand the exact different between using .
and []
to get a value from an object:
const o = {name: "aaa", family: "bbb"};
print(o["name"]);
print(o.name);
Are there any cases that one would be preferable over the other one?