dimanche 25 février 2018

How do I get the answer to the random flash-card by clicking the panel?

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);
    }
   })
})

enter link description here




Aucun commentaire:

Enregistrer un commentaire