Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
src/scripts/main.js
Outdated
| li.textContent = key; | ||
| list.append(li); | ||
|
|
||
| if (Object.data[key].length !== 0) { |
There was a problem hiding this comment.
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.
src/scripts/main.js
Outdated
| list.append(li); | ||
|
|
||
| if (Object.data[key].length !== 0) { | ||
| createTree(li. data[key]); |
There was a problem hiding this comment.
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]).
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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! ✨
No description provided.