Last active
March 14, 2017 01:42
-
-
Save dleitee/a6de53cb3442832fa39cc39c38250155 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 account = { | |
balance: 1000, | |
bank: '', | |
number: '', | |
} | |
const deposit = (account, value) => { | |
return { | |
...account, | |
balance: account.balance + value, | |
} | |
} | |
deposit(account, 1000) // returns an account with balance = 2000 | |
deposit(account, 1000) // still returns an account with balance = 2000 | |
deposit(account, 1000) // no matter what happens, always will returns an account with balance = 2000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment