add task solution - #2062
Conversation
Whitefyre
commented
Aug 26, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because two core requirements are not met and they affect correctness and compliance with the task specification. 1) On or around line 30 in src/scripts/main.js, the employee name is read via innerText, but the task requires using data attributes for employee information. Please use something like child.dataset.name instead, aligning with the schema used for other fields. 2) The salary string-to-number conversion is done inline within the sort logic; the task explicitly requires a dedicated helper function for this conversion. Extract the conversion into a reusable helper (e.g., parseSalary(s)), and use it where sorting and data extraction occur. Additionally, consider returning salary as a number in getEmployees for consistency with the data attribute–based schema and to avoid repeated conversions. Once these changes are made, your otherwise solid sorting and data retrieval logic should fully meet the requirements. Keep up the good work—your sorting by salary (descending) is implemented correctly and close to complete.
✨ 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
| const newArr = []; | ||
|
|
||
| for (const child of list.children) { | ||
| newArr.push({ |
There was a problem hiding this comment.
The task requires using data attributes for employee information, but innerText is being used here. The name should come from a data attribute (e.g., child.dataset.name) rather than text content.
| for (const child of list.children) { | ||
| newArr.push({ | ||
| element: child, | ||
| salary: Number(child.dataset.salary.replace(/[$,]/g, '')), |
There was a problem hiding this comment.
The task explicitly requires a 'helper function' for converting salary string to number, but this conversion is currently inline. Consider extracting it into a separate helper function as specified.
| newArr.push({ | ||
| name: child.innerText, | ||
| position: child.dataset.position, | ||
| salary: child.dataset.salary, |
There was a problem hiding this comment.
The salary in getEmployees is returned as a string, but since the employee schema should use data attributes consistently and other numeric values are stored, consider whether salary should be converted to a number here as well for consistency.
|
@mateacademy-ai-mentor I add helper function parseSalary(s). As for |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because the core requirements are met: you implemented a dedicated parseSalary(s) helper, used it appropriately in sorting, and correctly extract name via innerText given the HTML structure. The list is sorted by salary in descending order and data attributes for position, salary, and age are handled correctly. One minor improvement for consistency and schema compliance: on lines 34–37, salary: child.dataset.salary returns a string; the requirement expects a numeric salary, so consider using salary: parseSalary(child.dataset.salary) to align with the helper and return a number. This is not a blocker if tests don’t enforce the numeric schema, but it’s recommended for correctness and consistency. Great work overall—clean implementation and thoughtful handling of the DOM structure.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨