Conversation
freelinex
commented
Feb 7, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on this task! Your solution correctly sorts the list of employees by salary, and the helper function for converting the salary string is well-implemented. I am approving your submission as you've met all the core requirements.
For future improvement, consider the data types in the objects returned by your getEmployees function. Currently, salary and age are stored as strings. It's a best practice to store numerical data as numbers to ensure data consistency and make it easier to perform calculations later. You could easily reuse your toNumber helper for the salary and use the unary + operator for the age to make these conversions.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
|
|
||
| employer.name = item.textContent.trim(); | ||
| employer.position = item.dataset.position; | ||
| employer.salary = item.dataset.salary; |
There was a problem hiding this comment.
The salary property is assigned the raw string value from the data-salary attribute (e.g., "$2,500"). It's better practice to store numerical data as numbers. You can reuse your toNumber helper function here to parse the salary into a numeric value.
| employer.name = item.textContent.trim(); | ||
| employer.position = item.dataset.position; | ||
| employer.salary = item.dataset.salary; | ||
| employer.age = item.dataset.age; |
There was a problem hiding this comment.
Similar to salary, the age is a numerical value but is being stored as a string. Consider converting it to a number (for example, using the unary + operator) to make the employee object's data more useful and consistent.