Solution#1996
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Changes are needed to fully meet the task requirements. While your implementation correctly sorts employees by salary in descending order and returns the proper array structure, you've missed a specific requirement outlined in Step 2. The task explicitly requires extracting the salary-to-number conversion into a helper function. Currently, the conversion replace(/[$,]/g, '') is done inline within the sortList callback. Create a named helper function like parseSalary(element) that accepts an element and returns the parsed salary as a number. Then call this helper function in both sortList (for sorting) and getEmployees (for the returned objects). This follows the modular design principle of extracting reusable logic.
✨ 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 items = [...list.querySelectorAll('li')]; | ||
|
|
||
| items.sort((a, b) => { | ||
| const aSalary = a.dataset.salary.replace(/[$,]/g, ''); |
There was a problem hiding this comment.
The task requires a helper function to convert salary to number, but the conversion is done inline. Extract the conversion logic into a separate helper function as specified in Step 2.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation successfully meets all task requirements. The parseSalary helper function correctly extracts and converts salary values, and it's properly used in both sortList for descending salary order and getEmployees for the returned employee objects. All four properties (name, position, salary, age) are correctly extracted following the specified schema. The code is clean, functional, and ready for use.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
https://azesmmisha.github.io/js_task_parse_list_DOM/