Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Latest commit

 

History

History
102 lines (71 loc) · 3.04 KB

README.md

File metadata and controls

102 lines (71 loc) · 3.04 KB

multiChoice

Kind: global class

new multiChoice()

Create a multiple choice test

multiChoice.createForm([questions], [domElem])

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

multiChoice.shuffleAnswers(array) ⇒ Array

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

multiChoice.checkAnswer(e)

Check if selected option is the right answer, then check if everything is answered

Kind: instance method of multiChoice

Param Type
e *

multiChoice.calcScore()

Retrieve the number of correct answers

Kind: instance method of multiChoice

multiChoice.printMsg(score, [msgs])

Print the end message depending on the user score

Kind: instance method of multiChoice

Param Type Default
score *
[msgs] * this.messages

multiChoice.setEventListeners([domElem])

Set the event listeners to the inputs

Kind: instance method of multiChoice

Param Type Default
[domElem] * this.domElem

multiChoice.multiChoice

Kind: static class of multiChoice

new multiChoice(questions, scoreMsgs, domElem)

Creates an instance of multiChoice.

Param Type
questions Array.<Object>
scoreMsgs Array.<Object>
domElem HTMLElement