Skip to content

add task solution#1779

Open
mariiaherasymiukdev-bit wants to merge 2 commits into
mate-academy:masterfrom
mariiaherasymiukdev-bit:develop
Open

add task solution#1779
mariiaherasymiukdev-bit wants to merge 2 commits into
mate-academy:masterfrom
mariiaherasymiukdev-bit:develop

Conversation

@mariiaherasymiukdev-bit

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

  1. Rate AI review example

Comment thread src/scripts/main.js
// WRITE YOUR CODE HERE
const ul = document.createElement('ul');

for (const key in data) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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