Skip to content

Instantly share code, notes, and snippets.

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