Skip to content
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

done #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

done #1

wants to merge 1 commit into from

Conversation

fh292
Copy link

@fh292 fh292 commented Oct 15, 2024

No description provided.

@@ -2,61 +2,91 @@
// Write a JavaScript function that takes a customer's name and account balance and returns a string in the format: "CustomerName has a balance of balance KD."
function formatCustomerBalance(customerName, balance) {
// Write code here
return `${customerName} has a balance of ${balance} KD`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you forgot to add a dot at the end of the sentence

//if (books.year > 2010) return title;
let newArray = [];

books.filter((book) => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could have used a forEach instead of filter, because here you are not relaying on the return value of the filter, you are just using to loop over the array

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another way of solving this would be filtering then using map

// Write code here
customers.forEach((customer) => {
sentence.push(`${customer.name} has a balance of ${customer.balance} KD`);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you forgot to add a dot at the end of the sentence

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is working flawlessly, but it would have been better to use map instead

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