task solution#1988
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution has a critical issue that must be fixed. The sortList function accepts a list parameter but completely ignores it, instead using the global listOfEmployees variable. This breaks the function's reusability and violates the requirement that the function should take and use a list parameter. You need to replace all references to listOfEmployees inside the function with the list parameter — for example, change listOfEmployees.querySelectorAll('li') to list.querySelectorAll('li'), and listOfEmployees.append to list.append. Additionally, the getEmployees function returns salary as a string, but the expected schema likely requires a numeric value — consider using parseFloat() or your convertToNumber helper for the salary property. The core sorting logic and overall structure look solid, so these fixes should get you to a passing implementation.
✨ 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
| } | ||
|
|
||
| function sortList(list) { | ||
| const sorted = [...listOfEmployees.querySelectorAll('li')].sort((a, b) => { |
There was a problem hiding this comment.
The list parameter is ignored - the function uses the global listOfEmployees variable instead. Use list parameter to query the list items for proper function behavior.
| ); | ||
| }); | ||
|
|
||
| sorted.forEach((employee) => listOfEmployees.append(employee)); |
There was a problem hiding this comment.
Same issue as line 14 - this should be list.append(employee) to use the passed parameter, not the global variable.
| function getEmployees(list) { | ||
| const employees = [...list.querySelectorAll('li')].map((employee) => { |
There was a problem hiding this comment.
The function takes list as a parameter but uses listOfEmployees directly instead. This defeats the purpose of the parameter. Change listOfEmployees.querySelectorAll('li') to list.querySelectorAll('li').
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved and meets all requirements. Both critical issues from the previous review have been successfully resolved: sortList now correctly uses its list parameter throughout, and getEmployees properly converts salary values to numbers using the convertToNumber helper function. The implementation follows the correct employee object schema with all required properties extracted properly. Great work on fixing the parameter usage and data type conversion - these were exactly the right changes to make. Your code is ready for use!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.