Scenario 1 continued

Your Code:

function validate(answer, correctAnswer){
  // store the learner´s answer
   SetValue ("cmi.interactions.0. ", answer);

  //check to see if user's answer is correct
  if( answer == correctAnswer ){
    //store the result, we store that they got this question correct
     SetValue("cmi.interactions.0. ", " ");
  }
  else{
    // store the result, we only store that they got this question incorrect
     SetValue ("cmi.interactions.0. ", " ");
  }
}
Code Example:

function validate(answer, correctAnswer){
// store the learner´s answer
SetValue("cmi.interactions.0.learner_response", answer);

  //check to see if user's answer is correct
  if( answer == correctAnswer ){
    //store the result, we store that they got this question correct
     SetValue("cmi.interactions.0.result", "correct");
  }
  else{
    // store the result, we only store that they got this question incorrect
     SetValue ("cmi.interactions.0.result", "incorrect");
  }
}