I don’t think it’s absolutely necessary to build the object dynamically to pass the challenge, but the notes I saved while I was figuring it out are presented below.
I think the bigger issues you’re running into are going to relate to the first and last points. (Wrong output type, and syntax that the JS engine is likely to misinterpret)
Wish I had saved the link to where I found this.
This was in my notes from when I was figuring out how to dynamically build an object, and dynamically add new keys to it.
Note the myObj={} is the prefered option to declare a blank object, but same effect as the first line of the example code.
Every one of the myObj lines after the initial const building results in a key being added and a value being defined with that key.
Play around with it a bit and you can get that running.
const myObj = new Object(),
str = 'myString',
rand = Math.random(),
obj = new Object();
myObj.type = 'Dot syntax';
myObj['date created'] = 'String with space';
myObj[str] = 'String value';
myObj[rand] = 'Random Number';
myObj[obj] = 'Object';
myObj[''] = 'Even an empty string';
// Data tests
myObj[(receivedData[0].type)] = [receivedData[0].data]
myObj[(receivedData[0].type)].push(receivedData[5].data)