Conversation
10hokageee
commented
Jan 26, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on the recursive implementation! The core logic correctly builds the nested list. However, this requires a small change to prevent a potential runtime error.
In src/scripts/main.js, the condition typeof data[key] === 'object' will be true if data[key] is null. This is an issue because the subsequent call to Object.keys(data[key]) will throw a TypeError when the value is null, crashing the script.
To fix this, please update your condition to also check that the value is not null. For example: data[key] !== null && typeof data[key] === 'object'. This will make your function more robust.
✨ 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
|
|
||
| newLi.textContent = `${key}`; | ||
|
|
||
| if (typeof data[key] === 'object' && Object.keys(data[key]).length) { |
There was a problem hiding this comment.
This condition can cause an error if data[key] is null. The expression typeof null evaluates to 'object', which would make the first part of your condition true. However, Object.keys(null) will then throw a TypeError. It's good practice to add a check for null to make your function more robust. For example: data[key] !== null.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this submission! I am approving your solution. You've successfully addressed the previous feedback by adding the null check in your recursive function, which makes the code much more robust and prevents potential errors. The implementation is clean, correct, and fully meets all the requirements of the task. Well done!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨