Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because it correctly implements the required table generation: you iterate over the people array, compute age as died - born, compute century with Math.ceil(person.died / 100), and create six cells per row (name, gender, born, died, age, century) that are appended to the .dashboard table as required [CHECKLIST ITEMS #1–#4, #8–#11]. Functionally, this fulfills the core task and there are no clear blockers that would prevent the page from working.
For future improvement, consider adding a guard after const table = document.querySelector('.dashboard'); so that you safely handle the case where the table is not found, for example:
const table = document.querySelector('.dashboard');
if (!table) return;Also, your gender mapping currently treats any non-'m' value as 'Female'; making this more explicit, such as sex === 'm' ? 'Male' : sex === 'f' ? 'Female' : 'Unknown', would avoid mislabeling unexpected or missing values and better reflects the intent of the gender column. These are minor robustness and clarity tweaks, but the main functional requirements are met—nice work on implementing the table generation cleanly.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| // you can remove it | ||
|
|
||
| // write your code here | ||
| const table = document.querySelector('.dashboard'); |
There was a problem hiding this comment.
|
|
||
| people.forEach((person) => { | ||
| const row = document.createElement('tr'); | ||
| const gender = person.sex === 'm' ? 'Male' : 'Female'; |
There was a problem hiding this comment.
The gender mapping person.sex === 'm' ? 'Male' : 'Female' will label any non-'m' value as Female. Consider an explicit mapping like person.sex === 'm' ? 'Male' : person.sex === 'f' ? 'Female' : 'Unknown' to avoid incorrect labels when sex is missing or unexpected (relates to the required gender cell in checklist item #2).
No description provided.