Develop#2004
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your code has a critical bug that's causing all tests to fail. On line where you have const listOfEmployees = [...document.querySelector('ul')], the spread operator is incorrectly wrapping the <ul> element. This creates an array of the ul's child nodes instead of passing the actual DOM element to your functions. Since arrays don't have a querySelectorAll method, both sortList and getEmployees fail when they try to call list.querySelectorAll('li'). The fix is straightforward: remove the spread operator and pass the element directly: javascript const listOfEmployees = document.querySelector('ul'); Once you make this change, your sortList and getEmployees functions will receive the actual <ul> element and work correctly. Your sorting logic and employee extraction are sound—the spread operator is the only thing preventing everything from functioning.
✨ 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
|
|
||
| // write code here | ||
|
|
||
| const listOfEmployees = [...document.querySelector('ul')]; |
There was a problem hiding this comment.
CRITICAL BUG: Wrapping document.querySelector('ul') in [...spread] creates an array containing the <ul> element. Both sortList and getEmployees call list.querySelectorAll('li'), but arrays don't have this method. Pass the <ul> element directly without spreading.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
All requirements have been successfully implemented: the sortList function correctly sorts employees by salary in descending order using b.dataset.salary - a.dataset.salary, the getEmployees function returns an array of employee objects with the correct schema, and the parseSalary helper properly converts string values to numbers by stripping currency symbols and commas. Both functions are invoked at the end of the file with the DOM element properly passed as an argument. The critical spread operator issue from the previous review has been resolved, and all checklist items pass. Great work on fixing the bug and completing the task!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.