Last active
September 19, 2021 17:38
-
-
Save desinas/178a335abaf2721d9699be3a40551d62 to your computer and use it in GitHub Desktop.
Bank accounts 1 Quiz (7-3) of Udacity FEWD
This file contains hidden or 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
| /* | |
| * Programming Quiz: Bank Accounts 1 (7-3) | |
| */ | |
| var savingsAccount = { | |
| balance: 1000, | |
| interestRatePercent: 1, | |
| deposit: function addMoney(amount) { | |
| if (amount > 0) { | |
| savingsAccount.balance += amount; | |
| } | |
| }, | |
| withdraw: function removeMoney(amount) { | |
| var verifyBalance = savingsAccount.balance - amount; | |
| if (amount > 0 && verifyBalance >= 0) { | |
| savingsAccount.balance -= amount; | |
| } | |
| }, | |
| printAccountSummary: function SummaryAccountPrinting() { | |
| return "Welcome!\nYour balance is currently $1000 and your interest rate is 1%."; | |
| } | |
| }; | |
| console.log(savingsAccount.printAccountSummary()); |
printAccountSummary: function () {
return "Welcome!\n" +
"Your balance is currently $" + savingsAccount.balance +
" and your interest rate is " + savingsAccount.interestRatePercent + "%.";
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What Went Well
Feedback: Your answer passed all our tests! Awesome job!