Scenario 5

Your Code

7. Help complete the following code to set the raw and scaled scores:

function updateScores( weight, answer, correctAnswer )
{
//get current values for raw and scaled scores that are stored in the LMS
var rawScore = GetValue ("cmi.
.
");
var scaledScore = GetValue ("cmi.
.
");
if(answer == correctAnswer){
rawScore++;
scaledScore += weight * 1;
//update the raw score
( "cmi.
.
",
);
//update the scaled score
SetValue ( "cmi.
.
", scaledScore );
}
//if the learner gets the question wrong, there is no change to either score
}
Code Example

7. Help complete the following code to set the raw and scaled scores:

function updateScores( weight, answer, correctAnswer ){
//get current values for raw and scaled scores that are stored in the LMS
var rawScore = GetValue ("cmi.score.raw");
var scaledScore = GetValue ("cmi.score.scaled");
if( answer == correctAnswer){ rawScore++;
scaledScore += weight * 1;
//update the raw score
SetValue ( "cmi.score.raw", rawScore );
//update the scaled score
SetValue ( "cmi.score.scaled", scaledScore );
}
//if the learner gets the question wrong, there is no change to either score
}