Skip to content

Instantly share code, notes, and snippets.

@cferdinandi
Created July 5, 2023 17:44
Show Gist options
  • Save cferdinandi/3d73dee1e3fc7954928177013a2bfea2 to your computer and use it in GitHub Desktop.
Save cferdinandi/3d73dee1e3fc7954928177013a2bfea2 to your computer and use it in GitHub Desktop.
class MyLibrary {
/**
* Create the constructor object
* @param {Number} start The starting amount
*/
constructor (start = 0) {
this.total = start;
}
/**
* Add money to the total
*/
add (num = 1) {
this.total = this.total + num;
}
/**
* Remove money from the total
*/
subtract (num = 1) {
this.total = this.total - num;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment