add solution#2025
Conversation
vladyslav-kukhar
commented
Jul 9, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because two checklist-driven requirements about function signatures are not yet met and will likely break the tests. Specifically, sortList and getEmployees are required to accept a list parameter ([CHECKLIST ITEM #3] and [CHECKLIST ITEM #5]), but your current implementations have no parameters and instead rely on outer-scope variables; this is a critical mismatch with the spec and will cause the automated checks to fail. To fix this, refactor sortList(list) so it derives its li items from the passed-in list (e.g., via list.querySelectorAll('li')) and call it as sortList(list) where you currently call sortList(). Similarly, refactor getEmployees(list) to read items from the given list rather than from the original items NodeList, and then call it as getEmployees(list); this will also ensure you’re working with the actual sorted DOM. In addition, please parse dataset.salary to a number when building employee objects so the salary field is numeric and consistent with how you handle salary during sorting, ideally via a small helper like parseSalary(value) reused in both sorting and employee creation. The core logic and overall structure are solid, so once these signature and data-handling fixes are in place, your solution should fully satisfy the task requirements. Keep going—these are targeted adjustments, and you’re very close to a complete and robust implementation.
✨ 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 list = document.querySelector('ul'); | ||
| const items = list.querySelectorAll('li'); | ||
|
|
||
| function sortList() { |
There was a problem hiding this comment.
sortList is required to take a list parameter (checklist item #3), but here it has no arguments and relies on outer variables. Refactor it to accept list and derive its items inside the function.
| const itemsArr = [...items]; | ||
|
|
||
| itemsArr.sort((a, b) => { | ||
| const salaryA = Number( |
There was a problem hiding this comment.
Here you convert salary to a number inline; consider moving this logic into a small helper function as hinted in the description, which can be reused in both sorting and employee creation.
|
|
||
| sortList(); | ||
|
|
||
| function getEmployees() { |
There was a problem hiding this comment.
getEmployees should take a list parameter (checklist item #5) and derive items from that list, but currently has no parameters and uses the outer items NodeList. Update the signature and implementation to work from the passed list.
| const user = { | ||
| name: item.textContent.trim(), | ||
| position: item.dataset.position, | ||
| salary: item.dataset.salary, |
There was a problem hiding this comment.
Salary is taken directly from dataset.salary as a string. Given the emphasis on converting salary from data attributes to numbers, consider parsing this to a number for the employee object to better match the intended schema.
| return result; | ||
| } | ||
|
|
||
| getEmployees(); |
There was a problem hiding this comment.
getEmployees is called without a list argument, but the requirements specify that it should take a list property. After changing the function signature, call it as getEmployees(list).