Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function lowerCase(ans) {
- var lowCase = ans.toLowerCase();
- return lowerCase;
- }
- var questions = ['How may strings does a violin have?', 'How many sides does an octagon have?',
- 'How many NBA championships did Michael Jordan win with the Chicago Bulls?'];
- var answers = ['FOUR','EIGHT','SIX'];
- var score = 0;
- function quiz(counter) {
- var guesses = 3;
- while (guesses > 0) {
- var ans = prompt(questions[counter]);
- if (ans == answers[counter]) {
- alert("Correct!");
- return guesses;
- } else {
- guesses--;
- alert("Incorrect, You have " +guesses+ " guesses remaining");
- }
- }
- return 0;
- }
- document.write(lowerCase(ans));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement