Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created March 22, 2019 14:34
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/20f0af0465461191e0ace036b637ef41 to your computer and use it in GitHub Desktop.
Save jasongorman/20f0af0465461191e0ace036b637ef41 to your computer and use it in GitHub Desktop.
function BankAccount() {
this.balance = 0;
this.credit = function (account, amount) {
account.balance += amount
}
this.debit = function (account, amount) {
if (amount > account.balance) {
throw "Insufficient funds error";
}
account.balance -= amount;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment