Repository navigation
Conversation
sarlam
left a comment
There was a problem hiding this comment.
Great work on this week, I made few comments here and there with one challenge around the leap year but you do not have to do them if do not wish to
| const convertYear = Number(year); | ||
|
|
||
|
|
||
| if(convertYear < 1 || convertYear > 9999){ |
There was a problem hiding this comment.
This is okay but if we truly want to be sure, we also should check whether convertYear is actually a number, something along the line of Number.isInteger
| else{ | ||
| console.log(`The year ${convertYear } Iis not a leap year because it is not divisible by 4`); | ||
|
|
||
| } |
There was a problem hiding this comment.
This all works really well
I would like to challenge you, this is optional.
If we drop the reason why it is or is not a leap year from the console.log we could try something else and try to make it fit here:
if (convertYear < 1 || convertYear > 9999) { // 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
There was a problem hiding this comment.
Took the challenge, updated with a single condition.
No description provided.