Class: Question

mathex. Question

new Question(prop) → {Object}

Questions - Question class

Parameters:
Name Type Description
prop Object Properties object
Properties
Name Type Description
text String The question text

The math to be parsed by mathjax must be placed inside the tag {%%}, i.e. {% 2^4=16 %}

answers Array Proposed answers. Each answer can contain mathjsx math.
correct_answer Number Index of the correct answer
Source:
Returns:
mathex.Question instance
Type
Object
Example
 
 var question = new mathex.Question({
  text: '2. Which of the following is an identity?',
  answers: [
    '{% 3x = 9 %}',
    '{% 2a = 5 %}',
    '{% 7 + 8 = 16 %}',
    '{% 15 - 9 = 6 %}'
  ],
  correct_answer: 3
})

Methods

checkAnswer(index, correct)

Checks the user answer

Checks the answer, updates the gui, saves the rating and shows a response message to the user
Parameters:
Name Type Description
index Number Index of the choosen answer
correct Number Index of the correct answer
Source:
Returns:
void

removeEvents()

Removes events from inputs

Source:
Returns:
void

run(router)

Executes the question

Renders the question activating the answers
Parameters:
Name Type Description
router Object The mathex.QuestionRouter instance
Source:
Returns:
void

setLast()

Sets the last property to true

Source:
Returns:
void