add task solution#1890
Conversation
annaskobara
commented
Jun 9, 2026
- DEMO LINK
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
|
|
||
| for (const element of inputElements) { | ||
| const inputName = element.name; | ||
| const capitalizedName = inputName[0].toUpperCase() + name.slice(1); |
There was a problem hiding this comment.
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.
|
|
||
| label.classList.add('field-label'); | ||
| label.htmlFor = element.id; | ||
| label.textContent = inputName.toUpperCase(); |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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! ✨