add task solution#1779
Conversation
mariiaherasymiukdev-bit
commented
Jun 24, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because the core requirements are all correctly implemented: createTree(element, data) builds a nested ul/li structure from the object, uses recursion, and manipulates the DOM as specified, and your index.html is wired up properly with the SCSS and script references. The behavior for the given nested food object will work as intended and should satisfy the functional tests.
The main technical nuance is in src/scripts/main.js, where you use a for...in loop over data; for this task’s plain objects it’s fine, but in more general scenarios you’d want to restrict iteration to own properties, e.g. Object.keys(data).forEach(...), to avoid inherited keys being processed. Non-code checklist items like confirming tests and DOM guidelines were followed are not visible directly in the code, but that does not block functionality here. As a minor polish, consider updating the page <title> in index.html to something more descriptive and, if desired, skipping creation of an empty ul when data has no keys. Overall, you met the essential requirements—nice work on the recursion and DOM handling.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| // WRITE YOUR CODE HERE | ||
| const ul = document.createElement('ul'); | ||
|
|
||
| for (const key in data) { |
There was a problem hiding this comment.
You’re using a for...in loop over data directly; while this works for plain objects in this task, it will also iterate inherited properties. Consider limiting to own keys (e.g., via Object.keys) if tests or future requirements expect stricter behavior.