title: Storing High Scores JavaScript
body: <pre><code>&lt;html&gt;
  
      &lt;body&gt; &lt;pre&gt;    
      &lt;script language ='JavaScript'&gt;
  
  document.write(" \n Welcome to the type what you see game the objective of the game is to simply answer what you see on screen by typing into the prompt box, you will press on the answer button next \n to the pictures and type and answer. Once you have moved down the page and had a go at all 5 questions, your result will be displayed once you press the result button. A correct \n answer will be worth 1 pointn an incorrect answer will be worth 0 points, best of luck!")
  
  var r = 0;
  
  function checkAnswer() {
  
      a = prompt('What animal is in the image?');
      if (a == 'dog') {
          alert('Well Done. Correct answer');
          r++;
      } else {
          alert('Sorry, incorrect, it is a dog');
      }
  
  }
  
  function checkAnswer2() {
      b = prompt('What animal is in the image?');
      if (b == 'hamster') {
          alert('Well Done. Correct answer');
          r++;
      } else {
          alert('Sorry, incorrect, it is a hamster');
      }
  }
  
  function checkAnswer3() {
      c = prompt('What animal is in the image?');
      if (c == 'hedgehog') {
          alert('Well Done. Correct answer');
          r++;
      } else {
          alert('Sorry, incorrect, it is a hedgehog');
  
      }
  
  }
  
  function checkAnswer4() {
      d = prompt('What animal is in the image?');
      if (d == 'turtle') {
          alert('Well Done. Correct answer');
          r++;
      } else {
          alert('Sorry, incorrect, it is a turtle');
      }
  }
  
  function checkAnswer5() {
      e = prompt('What animal is in the image?');
      if (e == 'hare') {
          alert('Well Done. Correct answer');
          r++;
      } else {
          alert('Sorry, incorrect, it is a hare');
      }
  }
  
  function showResult() {
      alert('the number of questions you answered correct was ' + r + ' 
      questions');
  
  }
  
      &lt;/script&gt;
  
      &lt;/pre&gt;
  
          &lt;p&gt;Question 1. What is this an image of?&lt;/p&gt;
          &lt;img src="http://static1.squarespace.com/static/532abed3e4b025f227941d11/t/532ce5e3e4b0f59c2979d8c2/1395451365611/" class="image1"&gt;
          &lt;button onclick="checkAnswer()"&gt;Answer&lt;/button&gt;
          &lt;p&gt;Question 2. What is this an image of?&lt;/p&gt;
          &lt;img src="http://www.hamsters.co.uk/hamsters_images/syrian-hamster_000008437184.jpg" class="image2"&gt;
          &lt;button onclick="checkAnswer2()"&gt;Answer&lt;/button&gt;
          &lt;p&gt;Question 3. What is this an image of?&lt;/p&gt;
          &lt;img src="http://www.hellohedgehog.com/wp-content/uploads/2013/08/Hedgehog-7.jpg" class="image3"&gt;
          &lt;button onclick="checkAnswer3()"&gt;Answer&lt;/button&gt;
          &lt;p&gt;Question 4. What is this an image of?&lt;/p&gt;
          &lt;img src="http://s.hswstatic.com/gif/turtle-shell-1.jpg" class="image4"&gt;
          &lt;button onclick="checkAnswer4()"&gt;Answer&lt;/button&gt;
          &lt;p&gt;Question 5. What is this an image of?&lt;/p&gt;
          &lt;img src="http://static.guim.co.uk/sys-images/Education/Pix/pictures/2011/5/19/1305816821363/The-Irish-hare-is-under-t-007.jpg" class="image5"&gt;
          &lt;button onclick="checkAnswer5()"&gt;Answer&lt;/button&gt;
          &lt;button onclick="showResult()"&gt;Result&lt;/button&gt;
      &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>As I am new to javascript, what would be the easiest way too store a high score, I have a score displaying when you click result, but would be nice to store the users scores?</p>