[Solved] Combining nested objects [closed]


I propose a solution for a input as an array of objects and an output as an object

var data = [{question: "FirtName", answer: "Daniel"},
             {question: "LastNane", answer: "Daniel2"},
             {question: "Age", answer: 80}
           ];
var result = {};
data.forEach(x => {
  result[x.question] = x.answer;
});
console.log(result);

1

solved Combining nested objects [closed]