Skip to content

Solution#1996

Open
azesmmisha wants to merge 3 commits into
mate-academy:masterfrom
azesmmisha:develop
Open

Solution#1996
azesmmisha wants to merge 3 commits into
mate-academy:masterfrom
azesmmisha:develop

Conversation

@azesmmisha
Copy link
Copy Markdown

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Changes are needed to fully meet the task requirements. While your implementation correctly sorts employees by salary in descending order and returns the proper array structure, you've missed a specific requirement outlined in Step 2. The task explicitly requires extracting the salary-to-number conversion into a helper function. Currently, the conversion replace(/[$,]/g, '') is done inline within the sortList callback. Create a named helper function like parseSalary(element) that accepts an element and returns the parsed salary as a number. Then call this helper function in both sortList (for sorting) and getEmployees (for the returned objects). This follows the modular design principle of extracting reusable logic.


✨ 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js Outdated
const items = [...list.querySelectorAll('li')];

items.sort((a, b) => {
const aSalary = a.dataset.salary.replace(/[$,]/g, '');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task requires a helper function to convert salary to number, but the conversion is done inline. Extract the conversion logic into a separate helper function as specified in Step 2.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your implementation successfully meets all task requirements. The parseSalary helper function correctly extracts and converts salary values, and it's properly used in both sortList for descending salary order and getEmployees for the returned employee objects. All four properties (name, position, salary, age) are correctly extracted following the specified schema. The code is clean, functional, and ready for use.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants