I am trying to make a random flash card type of generator for javascript syntax. When i hit the random question button, it will display a random question such as "What is a variable?" but on clicking the panel, it should display the answer out of the answer array. All of the answers are in an object. I am 3 months new to programming, so any advice is appreciated.
$('button').on('click', function(){
var ranQuestion = Math.floor(Math.random()* arrOfQuestions.length);
$('#panel').html(arrOfQuestions[ranQuestion]);
//produce answer in the panel html onclick
$('#panel').on('click', function(){
var pan = $('#panel').html();
if(pan === arrOfQuestions){
$('#panel').html(test);
}
})
})
Aucun commentaire:
Enregistrer un commentaire