title: Store score in a variable after an event
body: <p><strong>Desirable result:</strong> After the user choose an answer, I want to modify <code>score</code> variable in:
  <code>score += 1</code> if the answer is right either not changing at all if the answer is wrong.<br/>
  <strong>Current result:</strong> For every choice user is making, the score remains the same: <code>0</code>.</p>
  
  <p>First, I store the paragraph that will be changed in <code>question_paragraph</code> and the button that will be clicked by user in <code>next_button</code>. Also, I stored the value(I put the attribute <code>value</code> on every input using the array notation - 0 first, 1 second etc.) in <code>user_answer</code>.</p>
  
  <pre><code>var question_paragraph = document.getElementById('question');
  var next_button = document.getElementById('next');
  var i = 0;
  var user_answer = getCheckedValue(document.getElementsByName('choice'));
  var y = 0;
  var score = 0;
  </code></pre>
  
  <p>The <code>getCheckedValue</code> function will return the <code>value</code> attribute of my input if exists.</p>
  
  <pre><code>function getCheckedValue(radioObj) {
      var radioLength = radioObj.length;
      for(var z = 0; z &lt; radioLength; z++) {
          if(radioObj[z].checked) {
              return radioObj[z].value;
          }
      }
      return "Error!";
  }
  </code></pre>
  
  <p>Here is the <strong>problem</strong>. The function works fine, except the isolated area. <code>allQuestion</code> is my object where I stored the questions, the possible answers and the right answer, <code>correctAnswer</code>(I don't included it here but works correctly). I put a conditional statement to increase <code>y</code> and code>score with one if the <code>allQuestions[y].correctAnswer</code> is qual with the value of the <code>user_choice</code>.</p>
  
  <pre><code>function changeQuestion() {
  
      //PROBLEM
      if(allQuestions[y].correctAnswer == user_answer){
      score += 1;
      y++;
      } else{y++;}  
      //PROBLEM
  
  
  
      i = (i &lt; allQuestions.length) ? (i + 1) : 0;
      if (i == allQuestions.length) {
          i = 0;
          return question_paragraph.replaceChild(document.createTextNode(allQuestions[0].question), question_paragraph.firstChild);
      }
      var newNode = document.createTextNode(allQuestions[i].question);
      console.log(score);
      return question_paragraph.replaceChild(newNode, question_paragraph.firstChild);
  }
  </code></pre>
  
  <p>Finnaly, I called the <code>addHandler</code> function.</p>
  
  <pre><code>function addHandler(name, type, handler){
      if (name.addEventListener){
          name.addEventListener(type, handler, false);
      } else if (name.attachEvent){
          name.attachEvent("on" + type, handler);
      } else {
          name["on" + type] = handler;
      }
  }
  
  addHandler(next_button, 'click', changeQuestion);
  </code></pre>