Skip to content

Added functionality in main.js to dynamically create and populate a …#1760

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

Added functionality in main.js to dynamically create and populate a …#1760
a-chomicz wants to merge 1 commit intomate-academy:masterfrom
a-chomicz:develop

Conversation

@a-chomicz
Copy link

…table with person data, including name, gender, birthday, death year, age, and century.

…table with person data, including name, gender, birthday, death year, age, and century.
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

Great job on this task! Your solution correctly implements all the requirements, and the logic for calculating the 'age' and 'century' values is perfect. I am approving your submission.

As a small tip for future projects, it's a good practice to construct an entire element in memory before adding it to the live DOM. In your main.js file, you could move the table.append(tablerow); line to be after you've appended all the cells to the tablerow. This is a minor performance optimization and doesn't affect the functionality here, so no changes are needed. Keep up the excellent work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

death.textContent = person.died;
personAge.textContent = person.died - person.born;
century.textContent = Math.ceil(person.died / 100);
table.append(tablerow);

Choose a reason for hiding this comment

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

You're appending the row to the table before you've added the cells to it. While this works because tablerow is a live reference to the element, it's a better practice to construct the entire element in memory first. Try moving this line to after tablerow.append(...) on line 378. This minimizes direct changes to the live DOM, which is generally more efficient.

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