Kind: global class
Create a multiple choice test
Add a form to the DOM based on the given questions
Kind: instance method of multiChoice
Param | Type | Default |
---|---|---|
[questions] | * |
this.questions |
[domElem] | * |
this.domElem |
The Fisher-Yates (aka Knuth) shuffle
Kind: instance method of multiChoice
Returns: Array
- shuffled array
Param | Type | Description |
---|---|---|
array | Array |
array that you want shuffled |
Check if selected option is the right answer, then check if everything is answered
Kind: instance method of multiChoice
Param | Type |
---|---|
e | * |
Retrieve the number of correct answers
Kind: instance method of multiChoice
Print the end message depending on the user score
Kind: instance method of multiChoice
Param | Type | Default |
---|---|---|
score | * |
|
[msgs] | * |
this.messages |
Set the event listeners to the inputs
Kind: instance method of multiChoice
Param | Type | Default |
---|---|---|
[domElem] | * |
this.domElem |
Kind: static class of multiChoice
Creates an instance of multiChoice.
Param | Type |
---|---|
questions | Array.<Object> |
scoreMsgs | Array.<Object> |
domElem | HTMLElement |