Skip to content

Instantly share code, notes, and snippets.

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