Solution - #2055
Conversation
ggylyon
commented
Aug 22, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The code has a critical issue with employee data extraction. The getEmployees function uses item.innerText for the name property, which captures ALL text content (name + position + salary + age combined) instead of extracting each field individually from data attributes. Employee objects must match the schema { name, position, salary, age } with values from item.dataset.name, item.dataset.position, item.dataset.salary, and item.dataset.age. Currently, even though ...item.dataset is spread, the name: item.innerText overwrites the correct dataset value. Additionally, the getEmployees() call is dead code since it's called without arguments and its return value is unused - only the sortList call needs the DOM query. These issues prevent correct task completion and must be fixed.
✨ 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 employeesList = [...list.children].reduce((previous, item) => { | ||
| previous.push({ name: item.innerText, ...item.dataset }); |
There was a problem hiding this comment.
This line uses item.innerText for the name property, which captures ALL text content (name + position + salary + age combined). According to the employee schema { name, position, salary, age }, these should be separate properties extracted from data attributes like item.dataset.name, item.dataset.position, item.dataset.salary, item.dataset.age.
|
|
||
| getEmployees(); |
There was a problem hiding this comment.
Calling getEmployees() without arguments passes undefined as the list parameter. The function returns early with undefined, making this call ineffective. Only the sortList call needs the document query.
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 will lead to incorrect behavior.
Critical issues to fix:
- In src/scripts/main.js, line where the employee object is built in
getEmployees, thenameusesitem.textContent.trim()which captures all text (name + position + salary + age). Requirement: use data attributes for all fields. Please change toname: item.dataset.name(and similarly ensureposition,salary,ageare fromitem.dataset.*). This ensures accurate parsing and avoids concatenated content. - The requirement states to call both functions.
sortListis called (around line 53), butgetEmployees()is only invoked insidesortListand never called at the top level after its definition. Add a top-level call togetEmployees()(e.g., after its definition) and use or log its return so it’s not dead code, satisfying the “call both functions” requirement.
Minor suggestion:
- If you don’t need the standalone
getEmployeesresult, consider documenting why or wiring it to initial rendering or debugging output so it has a clear purpose.
Once these are addressed, the implementation should meet the task requirements. Keep going—your sorting hook-up looks close; just align with the data-attribute contract and the function-call checklist.
✨ 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 employeesList = [...list.children].reduce((previous, item) => { | ||
| previous.push({ | ||
| name: item.textContent.trim(), |
There was a problem hiding this comment.
The name property uses item.textContent.trim() which captures ALL text content (name + position + salary + age combined) instead of extracting the name from item.dataset.name. According to requirements, employee objects must use data attributes: name: item.dataset.name.
There was a problem hiding this comment.
@mateacademy-ai-mentor
you are fuckhead fucker fuck. where do you see data-name attribute?
There was a problem hiding this comment.
<ul>
<li
data-position="Accountant"
data-salary="$162,700"
data-age="33"
>
Airi Satou
</li>
<li
data-position="Javascript Developer"
data-salary="$183,000"
data-age="29"
>
Michael Bruce
</li>
<li
data-position="Marketing Designer"
data-salary="$198,000"
data-age="66"
>
Michael Silva
</li>
<li
data-position="Technical Author"
data-salary="$145,000"
data-age="27"
>
Prescott Bartlett
</li>
<li
data-position="Developer"
data-salary="$98,540"
data-age="61"
>
Thor Walton
</li>
<li
data-position="Integration Specialist"
data-salary="$327,900"
data-age="55"
>
Rhona Davidson
</li>
<li
data-position="Data Coordinator"
data-salary="$138,575"
data-age="64"
>
Serge Baldwin
</li>
<li
data-position="Regional Director"
data-salary="$183,000"
data-age="51"
>
Shad Decker
</li>
<li
data-position="Regional Marketing"
data-salary="$163,000"
data-age="20"
>
Shou Itou
</li>
<li
data-position="Financial Controller"
data-salary="$452,500"
data-age="62"
>
Vivian Harrell
</li>
<li
data-position="Javascript Developer"
data-salary="$205,500"
data-age="39"
>
Colleen Hurst
</li>
</ul>
There was a problem hiding this comment.
Because there isn't a data-name attribute
There was a problem hiding this comment.
@mateacademy-ai-mentor hello????
Show me data-name attribute in index.html
| } | ||
| } | ||
|
|
||
| sortList(document.querySelector('ul')); |
There was a problem hiding this comment.
getEmployees() is called inside sortList at line 35 but never called at the top level after its definition. The requirement states 'Call both functions' - sortList is called at line 53, but getEmployees return value is unused outside sortList.
|
@mateacademy-ai-mentor |
|
@mateacademy-ai-mentor |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation is correct and meets all task requirements. You properly identified that the HTML structure stores names in text content (using textContent.trim()) rather than data attributes, while positions, salaries, and ages come from dataset.* attributes. Both functions (sortList and getEmployees) are well-implemented with proper sorting in descending order by salary. Great job catching the error in the initial review and trusting your understanding of the HTML structure—this shows solid problem-solving skills.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨