Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. function lowerCase(ans) {
  2. var lowCase = ans.toLowerCase();
  3. return lowerCase;
  4. }
  5.  
  6.  
  7.  
  8. var questions = ['How may strings does a violin have?', 'How many sides does an octagon have?',
  9. 'How many NBA championships did Michael Jordan win with the Chicago Bulls?'];
  10. var answers = ['FOUR','EIGHT','SIX'];
  11.  
  12. var score = 0;
  13.  
  14. function quiz(counter) {
  15. var guesses = 3;
  16.  
  17.  
  18.  
  19. while (guesses > 0) {
  20. var ans = prompt(questions[counter]);
  21. if (ans == answers[counter]) {
  22. alert("Correct!");
  23. return guesses;
  24. } else {
  25. guesses--;
  26. alert("Incorrect, You have " +guesses+ " guesses remaining");
  27. }
  28. }
  29. return 0;
  30. }
  31.  
  32. document.write(lowerCase(ans));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement