How do I iterate through each question and save the question in a variable or show it in console? Here is what I tried, it doesn't throw error in console but it's not doing what I want either.
scienceQue: function(){
for (var i = 0; i <science.question.length; i++)
var ask = science.question[i];
console.log(ask);
},
science: [
{ question: "What size is",
choices: [10,44,15],
correctIndex: 1
},
{ question: "???",
choices: [0,1,2],
correctIndex: 2
}
]
}```
How do I iterate through each question and save the question in a variable or show it in console? Here is what I tried, it doesn't throw error in console but it's not doing what I want either.