-
-
Save cferdinandi/7cfd240de490308b88b3207a54d06c3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Constructor Pattern Boilerplate | |
*/ | |
let MyLibrary = (function () { | |
/** | |
* Create the Constructor object | |
* @param {Number} start The starting amount | |
*/ | |
function Constructor (start = 0) { | |
this.total = start; | |
} | |
/** | |
* Add money to the total | |
*/ | |
Constructor.prototype.add = function (num = 1) { | |
this.total = this.total + num; | |
}; | |
/** | |
* Remove money from the total | |
*/ | |
Constructor.prototype.subtract = function (num = 1) { | |
this.total = this.total - num; | |
}; | |
return Constructor; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment