Folloze interview question

Home exercise in JavaScript though the emphasis is on good software design