Skip to content

Conversation

@halyna1995
Copy link

No description provided.

@remarcmij remarcmij self-assigned this Jan 21, 2026
Copy link

@remarcmij remarcmij left a comment

Choose a reason for hiding this comment

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

Hi @halyna1995, something strange happened with the code of task-2. However, it works fine just the same. I have some other minor comments but will approve your PR now.

setupEventListeners();

export { errorMessage, successMessage };
export { showMessage };

Choose a reason for hiding this comment

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

I'm not sure what happened. This looks like an older version of the assignment that Stas has changed since. Did you make these changes?

task-2/login.js Outdated
Comment on lines 6 to 12
function errorMessage(message) {
showMessage(message, "error");
}

function successMessage(message) {
showMessage(message, "success");
}

Choose a reason for hiding this comment

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

These functions were supposed to be in the app.js file which was not be touched.

task-2/login.js Outdated

// after increment, if now blocked -> show blocked (requirement 3+4)
if (incorrectAttempts >= 4) {
errorMessage("Login blocked: Too many incorrect attempts", "error");

Choose a reason for hiding this comment

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

Your errorMessage() function takes only one parameter.

);
}
} else {
console.log("Invalid selection. Please choose either 1 or 2.");

Choose a reason for hiding this comment

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

If you add an option 3, it should also be reflected in the error message.

Comment on lines +37 to +44
} else if (menuSelection === "1") {
// EUR -> USD
const eurAmountInput = prompt("Enter amount in EUR: ");
const eurAmountNum = Number(eurAmountInput);

if (Number.isNaN(eurAmountNum) || eurAmountNum <= 0) {
console.log("Please enter a valid positive number for the amount.");
} else {

Choose a reason for hiding this comment

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

You already handled option 1 in the code above.

halyna1995 and others added 4 commits January 24, 2026 18:46
Reset incorrect attempts on successful login.
Co-authored-by: Jim Cramer <remarcmij@gmail.com>
Copy link

@remarcmij remarcmij left a comment

Choose a reason for hiding this comment

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

Hi @halyna1995, it looks like I approved too soon.

@@ -1,12 +1,34 @@
// Do not change the line below
import { errorMessage, successMessage } from './app.js';
import { showMessage } from './app.js';

Choose a reason for hiding this comment

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

Have you tried running this code in the browser? It no longer runs because you now need to import errorMessage and successMessage from app.js.

if (isValid) {
successMessage("Logged in successfully");
incorrectAttempts = 0;
incorrectAttempts = 0;

Choose a reason for hiding this comment

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

Why do you have the same line duplicated here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants