Repository navigation
solution - #2097
solution#2097pohonets-crypto wants to merge 2 commits into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation is functionally correct - the sorting and data extraction work as expected. However, you're missing a required helper function. The task explicitly states: "Salary from data attribute is a string, do not forget to convert it to number, write helper function for it." Currently, the conversion Number(item.dataset.salary.replace(/[$,]/g, '')) is duplicated inline in both sortList and getEmployees functions. You need to extract this to a named helper function (e.g., parseSalary(salaryString)) and call it in both places. This is a core requirement violation, not just a style preference.
✨ 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
| Number(b.dataset.salary.replace(/[$,]/g, '')) - | ||
| Number(a.dataset.salary.replace(/[$,]/g, '')), |
There was a problem hiding this comment.
The task requires writing a helper function for converting salary string to number, but the conversion Number(item.dataset.salary.replace(/[$,]/g, '')) is repeated inline 3 times. Extract this to a separate helper function and use it in both places.
| return [...listObj.children].map((item) => ({ | ||
| name: item.textContent.trim(), | ||
| position: item.dataset.position, | ||
| salary: Number(item.dataset.salary.replace(/[$,]/g, '')), |
There was a problem hiding this comment.
Same issue - salary conversion should use the helper function here too.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved. The implementation correctly addresses all task requirements: the getSalary helper function is properly defined and used in both sortList and getEmployees functions to convert salary strings to numbers. The list is sorted in descending order by salary using (a, b) => getSalary(b) - getSalary(a), employee objects are extracted with the correct schema (name, position, salary, age), and both functions are properly invoked. All checklist items pass and no issues were found.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.