Repository navigation
Hassan A. - #2
ElevenEight118 wants to merge 5 commits into
Conversation
RHSebregts
left a comment
There was a problem hiding this comment.
Hi!
Thank you for your assignment. There are some small details that could be fixed, please do so. But good work so far!
Thank you!
| if (year >= 0 && year <= 9999) { | ||
| if (year % 400 === 0) { | ||
| console.log(`Yes, year ${year} is leap`); | ||
| } else if (year % 4 === 0 && year % 100 !== 0) { | ||
| console.log(`Yes, year ${year} is leap`); | ||
| } else { | ||
| console.log(`No, year ${year} is not leap`); | ||
| } | ||
| } else { | ||
| console.log("Invalid year"); | ||
| } |
There was a problem hiding this comment.
Putting an entire block into an if is considered bad practice. It can lead to what we call nested-ifs which makes it very hard to reach. Please try and prevent that if possible, your readers will thank you!
|
|
||
| let year = Number(prompt("Enter year:")); | ||
|
|
||
| if (year >= 0 && year <= 9999) { |
There was a problem hiding this comment.
When running this code, 0 is a leap year!
There was a problem hiding this comment.
I changed the code to avoid integer numbers.
|
|
||
| if (year >= 0 && year <= 9999) { | ||
| if (year % 400 === 0) { | ||
| console.log(`Yes, year ${year} is leap`); |
There was a problem hiding this comment.
I'm not sure you can say "x is leap"!
There was a problem hiding this comment.
The grammatical error has been fixed.
| if (username === "admin" && password === "Hack1234" || | ||
| username === "user" && password === "7654321" |
There was a problem hiding this comment.
Reading this statement is somewhat hard, because the grouping is not entirely clear, it almost seems like we can have password === "Hack1234" || username === "user". Could you group these statements a bit more?
There was a problem hiding this comment.
I have placed parentheses around each user to make them easier to read.
|
|
||
| // Exchange rate for EUR/USD (How much 1 EUR is in USD) | ||
| const EUR_USD_RATE = 1.1643; | ||
| const EUR_USD_RATE = 1.118; |
There was a problem hiding this comment.
As there were no comments regarding this section, I opted to verify the exchange rate used during the development of converter.js and align it accordingly.
No description provided.