-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
task solution #1416
base: master
Are you sure you want to change the base?
task solution #1416
Conversation
OwlDevcUA
commented
Mar 1, 2025
- DEMO LINK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the script to dynamically create a table and calculate the age and century of death! 🎉 While there are a couple of minor improvements suggested, such as removing redundant code and ensuring rows are appended correctly, these do not critically impact the functionality. Keep up the good work and consider these suggestions for future enhancements! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
src/scripts/main.js
Outdated
people.forEach((person, index) => { | ||
const row = table.insertRow(index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inserting a row at the index of the loop iteration might not work as expected if the table already contains rows. Consider using table.insertRow(-1)
to always append the new row at the end of the table.
src/scripts/main.js
Outdated
cell5.innerHTML = person.died - person.born; | ||
cell6.innerHTML = Math.ceil(person.died / 100); | ||
|
||
table.appendChild(row); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appending the row to the table is redundant since insertRow
already adds the row to the table. You can remove this line.