Created
March 22, 2019 14:57
-
-
Save jasongorman/3e0d750fe069588dc25875ed5ae6b695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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