Come Sail Away with Design Patterns

function Factory () {
this.createEmployee = function (type){
const employee

if(type == "FT"){
employee = new FullTime()
}
...
...
employee.type = type employee.hoursAllotted = function () {
log.add(this.type + "works for" + this.hours
}
return employee
}}const FullTime = function () {
this.hours = "40 hours"
}const Contractor = function () {
this.hours = "20 hours"
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store