Added functionality in main.js to dynamically create and populate a …#1760
Added functionality in main.js to dynamically create and populate a …#1760a-chomicz wants to merge 1 commit intomate-academy:masterfrom
Conversation
…table with person data, including name, gender, birthday, death year, age, and century.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| death.textContent = person.died; | ||
| personAge.textContent = person.died - person.born; | ||
| century.textContent = Math.ceil(person.died / 100); | ||
| table.append(tablerow); |
There was a problem hiding this comment.
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.
…table with person data, including name, gender, birthday, death year, age, and century.