Repository navigation
Eskedar - #4
Eskedar#4sheskedar-lab wants to merge 2 commits into
Conversation
sarlam
left a comment
There was a problem hiding this comment.
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
| return; | ||
| } | ||
| if (username === "admin" && password ==="Hack1234") { | ||
| console.log(successMessage("Login Successful!")); |
There was a problem hiding this comment.
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
| console.log(successMessage("Login Successful!")); | |
| successMessage("Login Successful!"); |
There was a problem hiding this comment.
when using errorMessage or successMessage there is no need to wrap them with console.log
There was a problem hiding this comment.
Perfect! everything works really well 👍
| 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."); | ||
| } |
There was a problem hiding this comment.
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
No description provided.