-
Notifications
You must be signed in to change notification settings - Fork 1.9k
solution #1892
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: master
Are you sure you want to change the base?
solution #1892
Conversation
mateacademy-ai-mentor
left a comment
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.
Review Summary
Great job on implementing the core functionality! The sorting logic works correctly and the employee data is parsed into the required object structure.
However, this requires a couple of changes to fully align with the task requirements. The sortList and getEmployees functions should accept the <ul> list element as a single argument, not an array of <li> items. You can then derive the list of items from the element inside the function, for example, by using Array.from(list.children).
Also, there's a small typo in a helper function name: parceSalary should be parseSalary. Please make these adjustments, and you'll be all set!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| const listOfEmployeesFromHtml = document.querySelector('ul'); | ||
| const employeesFromHtml = Array.from(document.querySelectorAll('li')); | ||
|
|
||
| function parceSalary(salary) { |
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.
There's a small typo in the function name. It should be parseSalary.
src/scripts/main.js
Outdated
| return parseFloat(salary.replace(/[$,]/g, '')); | ||
| } | ||
|
|
||
| function sortList(listElement, items) { |
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 function works, but its signature could be improved. The requirement states it should take a list property. You could pass just the listElement and then get the items from it inside the function (e.g., Array.from(listElement.children)). This would make the function more self-contained and reusable.
src/scripts/main.js
Outdated
| }); | ||
| } | ||
|
|
||
| function getEmployees(items) { |
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.
According to the task requirements, this function should take a list property (the <ul> element) as an argument, not an array of list items. You should get the list items from the passed list element inside this function.
mateacademy-ai-mentor
left a comment
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.
Review Summary
Excellent progress! I am approving your solution because you've successfully refactored the sortList and getEmployees functions to accept the <ul> element, which was the main requirement. The code now works as expected. There is just one minor typo remaining in the parceSalary function name, which should be parseSalary. While this doesn't break functionality, correcting it is important for code quality and was a point from the previous review. Please fix this small detail, but otherwise, great job!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| // write code here | ||
| const listOfEmployeesFromHtml = document.querySelector('ul'); | ||
|
|
||
| function parceSalary(salary) { |
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.
There's a small typo in the function name here. Based on the previous review feedback, it should be parseSalary.
Uh oh!
There was an error while loading. Please reload this page.