Sort and parse employee list - #2059
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution. The implementation meets the task requirements: both functions are correctly implemented and invoked, and getSalary properly handles string-to-number conversion. While there’s a minor consistency suggestion—inside getEmployees you may currently read item.dataset.salary as a string; consider using getSalary(item.dataset.salary) when building each employee object to ensure salary is always a number—this is not a blocker. Everything appears clean, follows the expected schema, and should function correctly. Nice work tightening up the helper usage and keeping the code clear and maintainable.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| function getEmployees(employeesList) { | ||
| return [...employeesList.children].map((item) => ({ | ||
| name: item.textContent.trim(), | ||
| position: item.dataset.position, | ||
| salary: item.dataset.salary, | ||
| age: item.dataset.age, | ||
| })); |
There was a problem hiding this comment.
The getEmployees function returns salary as a string (from item.dataset.salary). Consider converting it to a number using the getSalary helper function for consistency with how salary is typically represented in employee data objects.
DEMO LINK