Skip to content

solution#1883

Open
Kateryna7465 wants to merge 3 commits into
mate-academy:masterfrom
Kateryna7465:develop
Open

solution#1883
Kateryna7465 wants to merge 3 commits into
mate-academy:masterfrom
Kateryna7465:develop

Conversation

@Kateryna7465
Copy link
Copy Markdown

  1. Replace <your_account> with your Github username in the link
  2. Follow this instructions
    • Run npm run test command to test your code;
    • Run npm run test:only -- -n to run fast test ignoring linter;
    • Run npm run test:only -- -l to run fast test with additional info in console ignoring linter.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

The code contains two critical syntax errors on lines 9-10 that will prevent the script from working correctly. These are blockers because the required class="field-label" attribute and for attribute won't be set properly.

Issues to fix:

  1. Line 9 - label.classname = "field-labe" has two problems:

    • classname should be className (JavaScript DOM properties use camelCase)
    • The value is missing the last letter - should be "field-label" not `"field-labe"
  2. Line 10 - label.setAttribute = ("for", input.id) is incorrect syntax:

    • setAttribute is a method that must be called with parentheses: label.setAttribute("for", input.id)
    • Currently it's being assigned to rather than invoked as a function

Corrected lines:

label.className = "field-label";
label.setAttribute("for", input.id);

✨ 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
const input = inputs[i];

const label = document.createElement("label");
label.classname = "field-labe";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Two issues here: 1) classname should be className (camelCase for DOM properties), 2) the value is missing the last letter - should be "field-label" not "field-labe"

Comment thread src/scripts/main.js

const label = document.createElement("label");
label.classname = "field-labe";
label.setAttribute = ("for", input.id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

setAttribute is a method that needs to be called with parentheses: label.setAttribute("for", input.id). Currently it's being assigned to rather than invoked.

Copy link
Copy Markdown

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

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 one critical syntax error that prevents a required feature from working. On line 11, setAttribute is being assigned to (=) instead of being invoked as a method. This means label.setAttribute = ('for', input.id) assigns input.id to the setAttribute property rather than calling the method, so the label's for attribute will never be set. To fix this, change line 11 from label.setAttribute = ('for', input.id) to label.setAttribute('for', input.id); with proper parentheses. The rest of the implementation is correct, but this syntax error must be fixed before the labels can properly associate with their inputs.


✨ 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
const label = document.createElement('label');

label.className = 'field-label';
label.setAttribute = ('for', input.id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

setAttribute is a method that must be called with parentheses: label.setAttribute('for', input.id). Currently it's being assigned to (=) instead of being invoked, which means the for attribute will never be set and the label won't associate with the input.

…setAttribute('for', input.id); with proper parentheses.
Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

This is an educational approval to help you progress while learning.

You've implemented most requirements correctly—your label creation, class assignment, text content capitalization, and DOM insertion are all working well. There's one critical syntax error on line 11 that needs fixing: label.setAttribute = ("for", input.id) is assigning to the property instead of calling the method. This means the for attribute never gets set, breaking the label-input association.

Fix: Add parentheses around the arguments: label.setAttribute('for', input.id);

Remember: Methods need parentheses () to execute. When you write setAttribute = (...) you're overwriting the method itself rather than calling it.

Once that one-character fix is in place, your implementation will be complete. Great work overall!


✨ 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
const label = document.createElement('label');

label.className = 'field-label';
label.setAttribute = ("for", input.id);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a syntax error - setAttribute is being assigned to instead of being called as a method. Change this to label.setAttribute('for', input.id); with proper parentheses around the arguments.

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