Skip to content

add task solution#1890

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

add task solution#1890
annaskobara wants to merge 2 commits into
mate-academy:masterfrom
annaskobara:develop

Conversation

@annaskobara

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

The code has a critical bug on line 7 that will cause a ReferenceError at runtime. The variable name is referenced but was never declared — you declared inputName on line 6, so you need to use inputName.slice(1) instead of name.slice(1). This undefined variable reference will prevent all your DOM manipulation from executing. Additionally, the label text is being converted to ALL CAPS with .toUpperCase(), but the requirement states to set label textContent to "rely on input name" — meaning use the name as-is. The expected output shows title-case labels (e.g., "Email", "Password"), so remove the .toUpperCase() call or use a title-casing approach similar to how you handle the placeholder. To fix: 1. Change name.slice(1) to inputName.slice(1) on line 7; 2. Remove or adjust .toUpperCase() on the label's textContent assignment.


✨ 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

Comment thread src/scripts/main.js Outdated

for (const element of inputElements) {
const inputName = element.name;
const capitalizedName = inputName[0].toUpperCase() + name.slice(1);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Variable name is undefined here. Should use inputName to match the variable declared on line 6. This will cause a ReferenceError when the code runs.

Comment thread src/scripts/main.js Outdated

label.classList.add('field-label');
label.htmlFor = element.id;
label.textContent = inputName.toUpperCase();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The requirement states: 'Set textContent for label rely on input name.' Using .toUpperCase() makes it ALL CAPS instead of using the name as-is. Either remove the .toUpperCase() or use natural capitalization like the placeholder does.

@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

Your solution correctly implements all requirements from the task. The code properly selects form inputs, creates label elements with the field-label class, sets both the for attribute (pointing to the input's id) and title-cased text content based on each input's name attribute, and appends labels to the parent container before the inputs. All eight checklist items pass, and no test failures or linter issues were reported. The previous critical issues (undefined variable ReferenceError and incorrect capitalization approach) have been successfully resolved. 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