Conversation
Yevhen-Srdk
commented
Mar 10, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on this task! I'm approving your solution as it meets all the requirements. The table is generated correctly, and the age and century values are calculated perfectly.
As a point of improvement for the future, you could combine the two separate loops into a single one. Instead of first iterating to add the age and century properties to the objects and then iterating again to build the table, you can perform both operations in one pass. This is more efficient and avoids modifying the original people array, which is a good practice to prevent side effects.
This is just a suggestion for optimization, and your current implementation is fully correct. Keep up the excellent work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| people.forEach((person) => { | ||
| person.age = getPersonAge(person); | ||
| person.century = getPersonCentury(person); | ||
| }); |
There was a problem hiding this comment.
This loop iterates over the people array to add age and century properties, and then a second loop on line 365 iterates over it again to build the table. These two operations can be combined into a single loop for better efficiency.
This would also allow you to avoid modifying (mutating) the original person objects, which is a good practice to prevent unexpected side effects. The values for age, century, and the formatted gender can be calculated and used directly when creating the table cells.