solution#2011
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved because it correctly implements the required functionality and respects the key constraints. The sortList(list) function takes the ul element, collects its li children, sorts them by data-salary in descending order using a dedicated parseSalary helper, and re-appends the items, which matches the sorting requirements. The getEmployees(employeeList) function builds an array of objects with the required shape { name, position, salary, age }, pulling values from dataset and converting salary and age to numbers as specified. Both functions are called with the retrieved ul element, ensuring the behavior actually runs when the script loads.
One thing done well is the robust parseSalary helper, which can handle salary strings that include symbols/commas and avoids crashes by safely returning a number. As a minor improvement, you might consider whether returning 0 for invalid/missing salaries is what you want, or if you’d rather detect and handle such cases separately. Overall, your code is clear, functional, and aligned with the checklist requirements for this task. Great work on implementing the DOM parsing and sorting logic cleanly.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
DEMO LINK