-
Notifications
You must be signed in to change notification settings - Fork 966
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
solution #975
base: master
Are you sure you want to change the base?
solution #975
Conversation
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 functionality to dynamically add and remove rows and columns in the table! 🎉 Your code meets the task requirements and constraints effectively. Just a friendly reminder to ensure that the table always has at least one row and one column to prevent any potential runtime errors when accessing table.rows[0].cells.length
. Keep up the great work and happy coding! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
|
||
function isDisabled() { | ||
const rowCount = table.rows.length; | ||
const colCount = table.rows[0].cells.length; |
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.
Ensure that the table has at least one row and one column initially. Accessing table.rows[0].cells.length
without checking if table.rows
has any rows can lead to a runtime error if the table is empty.
}); | ||
|
||
appendColumn.addEventListener('click', () => { | ||
if (table.rows[0].cells.length < 10) { |
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.
Similar to the previous comment, ensure that table.rows
has at least one row before accessing table.rows[0].cells.length
to prevent potential runtime errors.
}); | ||
|
||
removeColumn.addEventListener('click', () => { | ||
if (table.rows[0].cells.length > 2) { |
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.
Before accessing table.rows[0].cells.length
, ensure that table.rows
is not empty to avoid runtime errors.
No description provided.