Skip to content

Add task solution#1931

Open
pavloPolyvoda-dev wants to merge 1 commit intomate-academy:masterfrom
pavloPolyvoda-dev:develop
Open

Add task solution#1931
pavloPolyvoda-dev wants to merge 1 commit intomate-academy:masterfrom
pavloPolyvoda-dev:develop

Conversation

@pavloPolyvoda-dev
Copy link

Copy link

@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

Great job on this task! Your solution meets all the requirements: the list is correctly sorted by salary, and the employee data is parsed perfectly. I'm approving your work.

I noticed a small opportunity for improvement in src/scripts/main.js. The logic to parse the salary is repeated inside the getEmployees function. To keep your code DRY (Don't Repeat Yourself), you can reuse the parseSalary helper function you already created:

const salary = parseSalary(employee);

This is a minor point about code quality and doesn't affect the functionality. Keep up the excellent work!


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

Footnotes

  1. Rate AI review example

return Array.from(list.children).map((employee) => {
const nameEmp = employee.textContent.trim();
const position = employee.dataset.position;
const salary = Number(employee.dataset.salary.replace(/[^0-9.-]+/g, ''));

Choose a reason for hiding this comment

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

This line duplicates the logic from the parseSalary helper function. To avoid repetition and keep your code DRY (Don't Repeat Yourself), you can reuse the helper function here:

const salary = parseSalary(employee);

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