question with answer
{
question: "Rogue was adopted by whom?",
answers: [
"Xavier",
"Wolverine",
"Jean Gray",
"Mystique"
],
correctAnswer: 1
}
//// print questions and answers for rogue
$(".rogue").append(myQuestions[5].question);
for (i = 0; i < myQuestions[5].answers.length; i++) {
$('<li><input type="radio" name="rbtnCount" value =' + i + '>' + myQuestions[4].answers[i] + "</li>").appendTo(".rogue")
}
$(".rogue").on("change", function () {
var selected = $('input[name=rbtnCount]:checked').val();
console.log(selected)
console.log(myQuestions[5].correctAnswer)
if (selected == myQuestions[5].correctAnswer) {
alert("its right!!!")
} else {
alert("better luck on nextone!!")
}
})
/// print score based on correct and incorrect
$(".corr").append(correctAnswer);
if(correctAnswer) <--- not certain on my next step here to create the scoring.
////我被困在这里,不了解我的下一步。需要根据所选的正确答案和不正确的分数创建分数。