Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created March 22, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/bceaecdf400426fc52916e517448a013 to your computer and use it in GitHub Desktop.
Save jasongorman/bceaecdf400426fc52916e517448a013 to your computer and use it in GitHub Desktop.
function BankAccount() {
this.balance = 0;
}
const credit = function (account, amount) {
account.balance += amount
}
const debit = function (account, amount) {
if (amount > account.balance) {
throw "Insufficient funds error";
}
account.balance -= amount;
}
module.exports = {BankAccount, credit, debit};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment