Skip to content

Solution#1746

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

Solution#1746
aholubko wants to merge 1 commit intomate-academy:masterfrom
aholubko:develop

Conversation

@aholubko
Copy link

No description provided.

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

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

  1. Rate AI review example

// you can remove it

// write your code here
const table = document.querySelector('.dashboard');

Choose a reason for hiding this comment

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

Consider guarding against a missing .dashboard element before appending rows to avoid runtime errors. For example, check if (!table) return; or handle the error—this improves resilience and directly relates to finding/appending to the table (checklist items #10 and #11).


people.forEach((person) => {
const row = document.createElement('tr');
const gender = person.sex === 'm' ? 'Male' : 'Female';

Choose a reason for hiding this comment

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

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).

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