When working with JavaScript I've come across a situation where I'm not sure if what I'm trying to accomplish is possible:
Considering the following object:
var data = {};
Is it possible to modify "data" in a way that when extending it in the following way
data.entry_1 = {
'prop_1': 'set_1',
'prop_2': 'set_2'
};
a new property gets automatically attached to the new object, that is to say
data.entry_1 = {
'prop_1': 'set_1',
'prop_2': 'set_2',
id: 1 // automatically created property
};
Is it possible to accomplish the above without having to use "external" methods, e.g. no data.newEntry(object)?