Skip to content

add task solution#1909

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

add task solution#1909
freelinex wants to merge 1 commit intomate-academy:masterfrom
freelinex:develop

Conversation

@freelinex
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 work on this task! Your solution correctly sorts the list of employees by salary, and the helper function for converting the salary string is well-implemented. I am approving your submission as you've met all the core requirements.

For future improvement, consider the data types in the objects returned by your getEmployees function. Currently, salary and age are stored as strings. It's a best practice to store numerical data as numbers to ensure data consistency and make it easier to perform calculations later. You could easily reuse your toNumber helper for the salary and use the unary + operator for the age to make these conversions.


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

Footnotes

  1. Rate AI review example


employer.name = item.textContent.trim();
employer.position = item.dataset.position;
employer.salary = item.dataset.salary;

Choose a reason for hiding this comment

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

The salary property is assigned the raw string value from the data-salary attribute (e.g., "$2,500"). It's better practice to store numerical data as numbers. You can reuse your toNumber helper function here to parse the salary into a numeric value.

employer.name = item.textContent.trim();
employer.position = item.dataset.position;
employer.salary = item.dataset.salary;
employer.age = item.dataset.age;

Choose a reason for hiding this comment

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

Similar to salary, the age is a numerical value but is being stored as a string. Consider converting it to a number (for example, using the unary + operator) to make the employee object's data more useful and consistent.

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