Using JavaScript, how can I set property of an object that already has property with the same name? For example, what i want to output is:
var obj = {
name: "foo"
};
obj[name] = "baz";
Normal output is:
console.log(obj) => {name:baz}
.
I want to output:
console.log(obj) => {name:foo,name:baz}
.
I know that is not the best practice, but is that possible?