add task solution#2020
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because it correctly implements the required functionality: the list is found in the DOM, sorted in descending order by the numeric salary from dataset.salary, re-appended to the list, and getEmployees builds objects with the expected name, position, salary, and age fields. All core behaviors described in the task are present, and there are no obvious runtime errors or broken functionality based on the current implementation.
The only potential concern is how you derive name using item.textContent.trim(), which could include extra text like the position depending on the actual HTML structure. If the markup provides a dedicated attribute such as data-name, consider using item.dataset.name instead so the name field matches exactly what the tests expect. This is more of a robustness/precision improvement than a critical blocker.
Overall, your code is clean, uses helper functions appropriately, and aligns well with the task’s requirements. Nice work on meeting the core parsing and sorting requirements; you’re very close to a production-ready solution, and tightening the name source would make it even stronger.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| const items = [...list.children]; | ||
|
|
||
| return items.map((item) => ({ | ||
| name: item.textContent.trim(), |
There was a problem hiding this comment.
For the name field you currently use item.textContent.trim(). Depending on the HTML structure, this may include position or other text; if the task expects the name from a specific data attribute (like data-name), you should read from that dataset property instead to match the "right objects" schema exactly.
No description provided.