Skip to content
A small javascript library for generating multiple choice test
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
node_modules
src
.gitignore
LICENSE
README.md
package-lock.json
package.json

README.md

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
You can’t perform that action at this time.