-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: main
Are you sure you want to change the base?
done #1
Conversation
@@ -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`; |
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.
you forgot to add a dot at the end of the sentence
//if (books.year > 2010) return title; | ||
let newArray = []; | ||
|
||
books.filter((book) => { |
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.
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
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.
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`); |
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.
you forgot to add a dot at the end of the sentence
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.
this is working flawlessly, but it would have been better to use map instead
No description provided.