I have an array of object and i want to loop through from this with the help of foreach but I got array I dont know why.
I want to display my array in a div.
This is my code:
var questions = [{
question: 'my name is?',
answere: ['jame', 'rock', 'batista', 'micheal'],
correctAnswere: 'Ahmad'
},
{
question: 'your name is?',
answere: ['jhon', 'rock', 'watson', 'cook'],
correctAnswere: 'Ahmad'
}];
var getquiz = document.getElementById('demo')
questions.forEach(function(arrayitem) {
getquiz = getquiz.innerHTML + arrayitem.question + "<br>";
});
<div id="getquiz">
</div>