add solution - #2070
add solution#2070justnicko wants to merge 2 commits into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The parseSalary function has a critical issue that violates a core requirement. While it successfully removes currency symbols and commas, it returns a string instead of a number as explicitly required by the task. You need to convert the cleaned string to an actual number using Number() or the unary plus operator (+). For example: return Number(cleaned.replace(/[$,]/g, '')); or return +cleaned.replace(/[$,]/g, '');. This matters because salary comparisons in sorting and any arithmetic operations will fail with string values instead of numbers.
✨ 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
| function parseSalary(salary) { | ||
| return salary.replaceAll(/,|\$/g, ''); |
There was a problem hiding this comment.
The parseSalary function returns a string after removing $ and commas, but the task explicitly requires 'Converts salary from string to number'. The returned salary in employee objects and the sorting comparison should use actual numbers. Wrap the result with Number() or use unary plus to convert it to a number type.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved. You correctly implemented sortList and getEmployees, invoked them, and ensured salary sorting is done numerically in descending order by converting salary strings to numbers (using the unary + with a cleaned string). The employee objects contain the required fields (name, position, salary, age) and are derived from the list’s dataset and text as expected. Functionality appears robust and meets the task requirements without critical issues.
Minor suggestions (non-blocking): consider trimming the employee name (e.g., textContent.trim()) to avoid stray whitespace, and double-check the README/demo link replacement outside of JS if that was part of your task instructions. Nice work keeping the code clear and focused on the requirements.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.