What I wanted to achieved is convert an array of object into an object.
mycode
var arr = data.questions
var obj = {};
for (let i = 0; i < arr.length; i++) {
obj[arr[i].key] = arr[i].value;
}
console.log(obj)
result
data
(2) [{…}, {…}]
0: {id: 48, questionaire: 94, question: "Helloworld", input_answer: null, order: 0, …}
1: {id: 49, questionaire: 94, question: "sadasdas", input_answer: null, order: 1, …}
length: 2
__proto__: Array(0)
want to achieve
questions {id: 11, questionaire: 16, question: "what?", input_answer: null, order: 0, …}