Skip to content

Eskedar - #4

Open
sheskedar-lab wants to merge 2 commits into
HackYourAssignment:mainfrom
sheskedar-lab:main
Open

sheskedar-lab wants to merge 2 commits into
HackYourAssignment:mainfrom
sheskedar-lab:main

Conversation

@sheskedar-lab

Copy link
Copy Markdown

No description provided.

@sarlam sarlam 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.

Really nice work on this week assignment 🎉

I made some suggestion and one challenge that you are free to do if you want but it is optional

Comment thread task-2/login.js
return;
}
if (username === "admin" && password ==="Hack1234") {
console.log(successMessage("Login Successful!"));

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 console.log here could be removed since successMessage already show a message to the user and to your knowledge does not return anything worth logging in the console

Suggested change
console.log(successMessage("Login Successful!"));
successMessage("Login Successful!");

Comment thread task-2/login.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

when using errorMessage or successMessage there is no need to wrap them with console.log

Comment thread task-3/converter.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perfect! everything works really well 👍

Comment thread task-1/leap-year.js
Comment on lines +7 to +17
if (!Number.isInteger(yearInput) || yearInput < 0){
console.log("Invalid year.");
}else if (yearInput % 400 === 0){
console.log("Yes " + yearInput + " is a leap year.");
} else if (yearInput % 4 !== 0){
console.log("No " + yearInput + " is not a leap year.");
} else if (yearInput % 100 === 0){
console.log("No " + yearInput + " is not a leap year.");
} else {
console.log("Yes " + yearInput + " is a leap year.");
}

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 works perfectly well, if you wish to challenge yourself and go one step further try to do it with only two conditions:

if (!Number.isInteger(yearInput) || yearInput < 0) { // Condition 1
  console.log("Invalid year.");
} else if (/* make your code here to compute the leap year in one go */) { // Condition 2
  console.log("Yes " + yearInput + " is a leap year.");
} else {
  console.log("Yes " + yearInput + " is a leap year.");
}

The challenge would be for you to fill in the condition in the else if

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