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

A small javascript library for generating multiple choice test

License

Notifications You must be signed in to change notification settings

ctrlaltdev/multichoicetest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A small javascript library for generating multiple choice test

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published