Repository navigation
solution - #2098
solution#2098smialeknicole 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 missing the required getEmployees function, which is a critical blocker. The task explicitly requires two functions: sortList and getEmployees. You need to implement getEmployees that takes a list parameter and returns an array of employee objects with the schema { name, position, salary, age }. Additionally, both functions need to be called in the code - currently only sortList is invoked at line 21. Please add the missing getEmployees function and ensure it's called to retrieve the employee data.
✨ 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
| 'use strict'; | ||
|
|
||
| // write code here | ||
| function sortList (list){ | ||
| const employees = Array.from(document.querySelectorAll('li')); | ||
|
|
||
| function formatNumber (salary) { | ||
| const formated = salary.slice(1).replace(",", ""); | ||
| return Number(formated); | ||
| } | ||
|
|
||
| employees.sort((a, b) => { | ||
| return (formatNumber(b.dataset.salary) - formatNumber(a.dataset.salary)); | ||
| }); | ||
|
|
||
| employees.forEach((item) => { | ||
| list.append(item); | ||
| }); | ||
| } | ||
|
|
||
| const list = document.querySelector('ul'); | ||
| sortList(list); |
There was a problem hiding this comment.
The getEmployees function is completely missing. The task requires two functions: sortList and getEmployees. This function should take a list parameter and return an array of objects with the schema: { name, position, salary, age }.
| } | ||
|
|
||
| const list = document.querySelector('ul'); | ||
| sortList(list); |
There was a problem hiding this comment.
Both functions need to be called in the code. Currently only sortList is called at line 21, but getEmployees should also be called to get the array of employees.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation fully addresses all the requirements from the task. The sortList function correctly sorts employees by salary in descending order using the formatNumber helper to convert salary strings to numbers, and the getEmployees function properly returns an array of employee objects with the required schema { name, position, salary, age }. Both functions are implemented with the correct parameters and are called in the code as expected. All checklist items pass, and there are no critical blockers preventing task completion.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.