cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Futurama JavaScript Quiz</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>Futurama JavaScript Quiz</h1>
<div id="output">

</div>
<script src="quiz.js"></script>
</body>
</html>
            
          
!
            
              @import url('https://necolas.github.io/normalize.css/3.0.2/normalize.css');

/*General*/
body {
  background: #fff;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  font: Helvetica Neue, Helvectica, Arial, serif;
  font-weight: 300;
  font-size: 1em;
  line-height: 1.5em;
  color: #8d9aa5;
}

a {
  color: #3f8aBf;
  text-decoration: none;
}

a:hover {
  color: #3079ab;
}

a:visited {
  color: #5a6772;
}

h1, h2, h3 {
  font-weight: 500;
  color: #384047;
}

h1 {
  font-size: 1.8em;
  margin: 60px 0 40px;
}

h2 {
    font-size: 1em;
    font-weight: 300;
    margin: 0;
    padding: 30px 0 10px 0;
}

#home h2 {
  margin: -40px 0 0;
}

h3 {
  font-size: .9em;
  font-weight: 300;
  margin: 0;
  padding: 0;
}

h3 em {
  font-style: normal;
  font-weight: 300;
  margin: 0 0 10px 5px;
  padding: 0;
  color: #8d9aa5;
}

ol {
  margin: 0 0 20px 32px;
  padding: 0;
}

#home ol {
  list-style-type: none;
  margin: 0 0 40px 0;
}

li {
  padding: 8px 0;
  display: list-item;
  width: 100%;
  margin: 0;
  counter-increment: step-counter;
}

#home li::before {
    content: counter(step-counter);
    font-size: .65em;
    color: #fff;
    font-weight: 300;
    padding: 2px 6px;
    margin:  0 18px 0 0;
    border-radius: 3px;
    background:#8d9aa5;
    line-height: 1em;
}

.lens {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid #8d9aa5;
  border-radius: 5px;
  position: absolute;
  margin: 5px 0 0 -19px;
}

#color div {
  width: 50px;
  height: 50px;
  display: inline-block;
  border-radius: 50%;
  margin: 5px;
}

span {
  color: red;
}
            
          
!
            
              var quizQA = [
  ["What year did Fry get locked into the cryogenic freezer?", "2000"],
  ["What job is Zoidberg horrible at?", "doctor"],
  ["Who is Fry's best friend?", "bender"],
  ["What is Fry's dog's name?", 'seymour'],
  ["Who is the most amazing toad ever?", "hypnotoad"]
];

function print(message) {
  document.write(message);
}

var guessCorrect = 0;
var guessIncorrect = 0;
var html;
var question;
var answer;
var response;
var correct = [];
var incorrect = [];

function buildList(arr) {
  var listHTML = '<ol>';
  for (var i = 0; i < arr.length; i += 1) {
    listHTML += '<li>' + arr[i] + '</li>';
  }
  listHTML += '</ol>';
  return listHTML;
}

for (var i = 0; i < quizQA.length; i++) {
  question = quizQA[i][0];
  answer = quizQA[i][1];
  response = prompt(question);

  if (response.toLowerCase() === answer) {
    guessCorrect += 1;
    correct.push(question);
  } else {
    guessIncorrect += 1;
    incorrect.push(question);
  }
}

console.log(correct);

html = "<h1>You got these right!</h1>";
html += buildList(correct);
html += "<h1>You got these wrong!</h1>";
html += buildList(incorrect);
print(html);

if (guessCorrect >= 3) {
  print("<h1>Great job! You got " + guessCorrect + " right and " + guessIncorrect + " questions wrong.</h1>")
} else {
  print("<h1>On no! You got " + guessCorrect + " right and " + guessIncorrect + " wrong. You should go watch more Futurama!</h1>")
}
            
          
!
999px
Loading ..................

Console