Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. const questions = [
  2.  
  3. {
  4. question: "What is 2 + 2?",
  5. answes: [3,4,5,6]
  6. },
  7. {
  8. question: "What is 6 + 2?",
  9. answes: [9,8,5,6]
  10.  
  11. },
  12. {
  13. question: "What is 10 + 30?",
  14. answes: [32,45,40,34]
  15.  
  16. }
  17.  
  18. ]
  19.  
  20. const p = document.getElementById("qtn");
  21. document.getElementById("next").addEventListener("click",()=> {
  22.  
  23. for (let i=0; i<questions.length;i++){
  24.  
  25. p.textContent = questions[i].question;
  26. }
  27.  
  28. });
  29.  
  30. const i=0;
  31. const p = document.getElementById("qtn");
  32. document.getElementById("next").addEventListener("click",()=> {
  33.  
  34.  
  35.  
  36. p.textContent = questions[i].question;
  37. i++
  38.  
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement