Skip to content
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 #976

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maksym-kostetskyi
Copy link

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.

Great job on implementing the core functionality of appending and removing rows and columns! 🎉 The code meets the task requirements and constraints effectively. However, there are a couple of critical issues that need attention:

  1. deleteRow Method Usage: Ensure that you pass the correct index to the deleteRow method, as it should take an index rather than a row object. This will prevent potential errors when trying to delete rows.

  2. Cell Count Check: Before checking the number of cells, make sure the table has at least one row and one cell to avoid errors when accessing table.rows[0].cells.length.

Once these issues are addressed, your code will be even more robust. Keep up the great work! 😊

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

removeRow.addEventListener('click', () => {
const row = table.rows[table.rows.length - 1];

table.deleteRow(row);

Choose a reason for hiding this comment

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

The deleteRow method should take an index as an argument, not a row object. You should pass table.rows.length - 1 directly to deleteRow instead of row.

table.rows[i].deleteCell(-1);
}

if (table.rows[0].cells.length === 2) {

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 cell before checking the number of cells. If the table is empty, accessing table.rows[0].cells.length will cause an error. Consider adding a check to ensure there is at least one row and one cell before this line.

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