Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on this task! I am approving your solution as it correctly implements all the requirements. The table is generated perfectly from the data, and your calculations for age and century are spot on.
As a suggestion for future improvement, it's a good practice to avoid modifying original data objects. In your code, you added a gender property directly to the person object. A more predictable approach is to store the derived value in a local variable without changing the source object, like this:
const gender = person.sex === 'm' ? 'Male' : 'Female';This helps prevent unexpected side effects in larger applications. Keep up the excellent effort!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| if (person.sex === 'm') { | ||
| person.gender = 'Male'; | ||
| } else { | ||
| person.gender = 'Female'; | ||
| } |
There was a problem hiding this comment.
While this code functions correctly, it modifies the original person object by adding a gender property. This is a side effect and is generally considered a practice to avoid. A better approach would be to determine the gender and store it in a local variable without altering the person object. For example:
const gender = person.sex === 'm' ? 'Male' : 'Female';
[x] DEMO LINK
[x] Your task today is to convert this array to table rows.
[x] 1) For each person from people array create table row with 6 table cells (name, gender, born, died, age, century)
[x] 2) Find a table with class dashboard in the document.
[x] 3) Append created row to table.
[x] 4) Done.