0👍
✅
that would be the code to my comment, not knowing if going with an object would be working for you…
postAnswerTest: function(modelId, topicId, questionId, answerId) {
var finalAnswer = {modelId, topicId, questionId, answerId};
this.finalObject[questionId] = finalAnswer;
console.log(this.finalObject);
},
Source:stackexchange.com