Skip to content

Conversation

@mohammedalfakih-dev
Copy link

No description provided.

@remarcmij remarcmij self-assigned this Jan 21, 2026
Copy link

@remarcmij remarcmij left a comment

Choose a reason for hiding this comment

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

Hi @mohammedalfakih-dev, thanks for your submission.In task-2 there is a simplication possible. Could you give it a try? The rest looks good. Actually, this duplication makes sense here.

if (Number.isNaN(year) || year < 1 || year > 9999) {
console.log("Invalid year!");
} else {
let isLeap =

Choose a reason for hiding this comment

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

  1. Prefer const over let if the variable does not need to be changed.
Suggested change
let isLeap =
const isLeap =
  1. Best practice for JavaScript is to indent by 2 spaces (you are using 4 spaces here).

task-2/login.js Outdated
Comment on lines 8 to 9
errorMessage("Login blocked: Too many incorrect attempts.");
} else {

Choose a reason for hiding this comment

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

You can return early from the function if there are too many incorrect attempts. By doing so, you can get rid of the else statement:

Suggested change
errorMessage("Login blocked: Too many incorrect attempts.");
} else {
errorMessage("Login blocked: Too many incorrect attempts.");
return;
}
const isAdmin ...

@mohammedalfakih-dev
Copy link
Author

hi,
Thanks for your helpful feedback. I updated the code based on your suggestions using an early return to simplify the flow and remove duplicate checks.
The logic now works the same but is cleaner and easier to read.
Appreciate your time and guidance it really helped me improve .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants