Skip to content

Instantly share code, notes, and snippets.

@desinas
Last active September 19, 2021 17:38
Show Gist options
  • Save desinas/178a335abaf2721d9699be3a40551d62 to your computer and use it in GitHub Desktop.
Save desinas/178a335abaf2721d9699be3a40551d62 to your computer and use it in GitHub Desktop.
Bank accounts 1 Quiz (7-3) of Udacity FEWD
/*
* 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());
@bouallati
Copy link

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