Repository navigation
Conversation
robzi18
commented
Nov 12, 2026
- All the required tasks from the assignment are done.
Naraujo13
left a comment
There was a problem hiding this comment.
Hey!
Great job on the Week 2 assignment! 🎉
It is great to see all three tasks running smoothly plus the creative touches like the loop in Task 1 and the UI lock in Task 2.
A side note: committing package-lock.json is totally fine and actually good practice in Node projects!
There are a couple of small logic fixes needed for Task 2.
Take a look at the inline comments and push an update when you're ready.
Feel free to reach out on Slack if anything is unclear!
Cheers
| function is_valid_year(y) { | ||
| return Number.isInteger(y) && y >= 1 && y <= 9999; | ||
| } | ||
| while (user_option) { |
There was a problem hiding this comment.
Nice script!
I like usage of the loop to allow testing of multiple values
| while (user_option) { | ||
| var year = prompt("Enter a year:"); | ||
| year = Number(year); | ||
| console.log(`year is ${year}`); |
There was a problem hiding this comment.
Bonus: adding logs like this is common and helps a lot during development, but a good practice is to remove them at the end
| } else { | ||
| errorMessage("Incorrect credentials."); | ||
| } | ||
| incorrectAttempts++; |
There was a problem hiding this comment.
Bug: This is outside the login conditionals. What happens if someone enters the correct credentials 4 times in a row?
| } else if (menuSelection === "3") { | ||
| console.log(`The current exchange rate is 1 Eur = ${EUR_USD_RATE} USD.`); | ||
| } else { | ||
| console.log("Invalid selection. Please choose either 1 or 2."); |
There was a problem hiding this comment.
Bonus: We have three options now that you implemented the exchange rate display
| if (incorrectAttempts >= 4) { | ||
| errorMessage("Login blocked: Too many incorrect attempts"); | ||
| lockWindow(5); // Lock the window for 5 seconds on 4th incorrect attempt | ||
| } |
There was a problem hiding this comment.
Bug: This is never executed, the incorrectAttempts variable is always reset beforehand. Why?