I'm trying to build a new nested object based on bracked notation. my syntax is
metaObj[subCat][attribute] = value;
and I have these variables; My goal is to achieve this structure
metaObj = {
chart : {
x: "random",
y: 123
},
data : {
x: "random",
y: 123
}
}
I should build it dynamically since the attribute names and categories might change in every scenario
I receive this error though
Uncaught TypeError: Cannot set property ---- of undefined