Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. const debit = (account, amount) => {
  2. if(amount > account.balance + account.limit){
  3. throw "Insufficient funds error";
  4. }
  5. return {...account, balance: account.balance - amount};
  6. }
  7.  
  8. module.exports = debit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement