-
Notifications
You must be signed in to change notification settings - Fork 131
feat(m5): added solution exercise 001 #2897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(m5): added solution exercise 001 #2897
Conversation
deposit(amount, description = "") { | ||
if (this.checkAmount(amount)) { | ||
this.ledger.push({ amount: +amount, description: description }); | ||
this.balance += +amount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a good idea to put it in the method.
See the following comment.
amount: -amount, | ||
description: description, | ||
}); | ||
this.balance -= amount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same situation.
* @returns {string} - returns formatted balance with two decimals | ||
*/ | ||
getBalance() { | ||
return +this.balance.toFixed(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if I asked you for the balance relating to only the first 5 movements and not the absolute balance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, I actually hadn't thought about this feature. I will solve this issue!
No description provided.