Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

EvaLa94
Copy link

@EvaLa94 EvaLa94 commented Feb 15, 2023

No description provided.

deposit(amount, description = "") {
if (this.checkAmount(amount)) {
this.ledger.push({ amount: +amount, description: description });
this.balance += +amount;

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;

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);

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?

Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants