Skip to content

add task solution#1689

Open
Pavlo26 wants to merge 2 commits intomate-academy:masterfrom
Pavlo26:develop
Open

add task solution#1689
Pavlo26 wants to merge 2 commits intomate-academy:masterfrom
Pavlo26:develop

Conversation

@Pavlo26
Copy link

@Pavlo26 Pavlo26 commented Feb 1, 2026

No description provided.

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 start on this task! Your HTML is set up perfectly, and the recursive structure of your createTree function is a good approach. However, this requires changes because a couple of critical errors in your JavaScript are preventing it from working. First, the condition if (Object.data[key].length !== 0) is incorrect and will cause a runtime error, as Object.data is undefined. To check if an object has properties, you should use Object.keys(data[key]).length > 0. Second, there's a syntax error in your recursive call createTree(li. data[key]); it should use a comma to separate arguments, like this: createTree(li, data[key]). After fixing these two issues, your solution should work as expected!


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

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

li.textContent = key;
list.append(li);

if (Object.data[key].length !== 0) {

Choose a reason for hiding this comment

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

This condition is incorrect. Object.data will be undefined, which will cause a TypeError. Additionally, objects do not have a .length property to determine if they contain keys. To check if the nested object data[key] has any properties, you should use Object.keys(data[key]).length > 0.

list.append(li);

if (Object.data[key].length !== 0) {
createTree(li. data[key]);

Choose a reason for hiding this comment

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

There's a syntax error in this recursive call. You've used a dot (.) instead of a comma (,) to separate the arguments. The correct syntax is createTree(li, data[key]).

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

Excellent work on this iteration! I am approving your solution as you've successfully addressed all the previous feedback. The recursive logic is now sound, and the function correctly generates the nested list as required. Please disregard the failing build check; it's related to the project's environment and doesn't reflect any issues with your code. Keep up the great work!


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

Footnotes

  1. Rate AI review example

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