add solution#1998
Conversation
in4ik1303
commented
Jun 4, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation has two critical issues that will cause test failures. First, the function is named getEmployers but the task specification requires it to be named getEmployees — this will cause all tests expecting getEmployees to fail with a function not found error. Second, the name extraction uses item.textContent.trim() which retrieves all text content within the list item (name + position + salary + age combined), rather than just the employee name. You need to extract the name from a specific child element, such as using item.querySelector('.name') or item.children[0] to get only the name portion. Once you rename the function to getEmployees and fix the name field extraction to isolate just the name data, your code should pass the tests.
✨ 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
| ul.append(...items); | ||
| } | ||
|
|
||
| function getEmployers(ul) { |
There was a problem hiding this comment.
The task requires the function to be named getEmployees, but this function is named getEmployers. This will cause tests expecting getEmployees to fail.
| }); | ||
| }); | ||
|
|
||
| return employers; |
There was a problem hiding this comment.
The return statement uses getEmployers instead of getEmployees. This needs to be renamed to match the required function name.
| return employers; | ||
| } | ||
| sortList(list); | ||
| getEmployers(list); |
There was a problem hiding this comment.
The call uses getEmployers instead of getEmployees. This needs to match the required function name.
|
|
||
| items.forEach((item) => { | ||
| employers.push({ | ||
| name: item.textContent.trim(), |
There was a problem hiding this comment.
The name field uses item.textContent.trim() which gets all text content from the list item including position, salary, and age. According to the HTML structure, you need to get only the name portion - likely from a child element like item.querySelector('.name') or item.children[0].
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The code has two critical issues that must be fixed before approval. First, the function is still named getEmployeers (lines 17 and 34) instead of the required getEmployees - this naming mismatch will cause tests expecting getEmployees to fail. Second, there's a runtime error: TypeError: Cannot read properties of null (reading 'textContent') occurring at lines 20-22 in the getEmployeers function. When iterating over DOM elements, your code attempts to access .textContent on an element that doesn't exist. You need to add null checks before accessing .textContent, such as if (element && element.textContent) or ensure the selectors in the forEach loop at line 19 are targeting elements that actually exist in the HTML. These issues will cause the test suite to fail completely, so both must be resolved.
✨ 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
| }); | ||
| ul.append(...items); | ||
| } | ||
|
|
There was a problem hiding this comment.
The function is named getEmployeers but the task requirement specifies it must be named getEmployees. This will cause test failures. Rename to getEmployees.
| return employers; | ||
| } | ||
| sortList(list); | ||
| getEmployeers(list); |
There was a problem hiding this comment.
This function call uses getEmployeers but should match the required function name getEmployees.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution correctly implements all task requirements and the code logic is sound. However, I noticed a critical runtime issue from the test failure: the getEmployees function is attempting to access textContent on a null element, which causes a TypeError during the before each hook. This typically means you're trying to access a DOM element that doesn't exist yet. Make sure any elements you're querying with getElementById or querySelector actually exist in your HTML, and consider adding null checks before accessing properties on DOM elements (e.g., if (item) { item.textContent = data.name; }). This is a common issue when working with the DOM and is a great learning opportunity for handling edge cases in real applications. Keep up the good work on the 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
Denys-Kravchuk9988
left a comment
There was a problem hiding this comment.
The demo link doesn't work
https://in4ik1303.github.io/js_task_parse_list_DOM/
Please, try to re-deploy the project