add task solution#1992
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation has two critical issues that prevent task completion. First, the name property extraction uses worker.textContent.trim() which captures all text content within the <li> element, not just the employee name. Since position, salary, and age are retrieved from data attributes, the name should also come from worker.dataset.name for consistency and correctness. Second, the return value of getEmployees(mainList) is not being stored—you need to assign it to a variable like const employees = getEmployees(mainList) to actually use the extracted data. Both issues are functional blockers that must be fixed before approval.
✨ 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
|
|
||
| return workerArray.map((worker) => { | ||
| return { | ||
| name: worker.textContent.trim(), |
There was a problem hiding this comment.
The name property should come from a data attribute (worker.dataset.name) rather than textContent.trim(). Using textContent will capture all text within the <li> element, not just the employee's name.
| sortList(mainList); | ||
| getEmployees(mainList); |
There was a problem hiding this comment.
The return value of getEmployees is not being stored. Consider assigning it to a variable, e.g., const employees = getEmployees(mainList);
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation is approved. All task requirements are met: the sortList function correctly sorts employees by salary in descending order using childB - childA, the getEmployees function properly extracts and returns an array of employee objects with the correct schema {name, position, salary, age}, the salary values are converted to numbers using the helper function, and both functions are called with the main list element. The previous review issues have been resolved—the name property now correctly uses worker.dataset.name, and the return value of getEmployees() is properly stored. Great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
DEMO LINK