Design comparison
Solution retrospective
Not a javascript master, let me know what i could improve!
Community feedback
- @rafaelmaiachPosted almost 5 years ago
First, the reproduction of the challenge is very good. Congratulations. About the Javascript part, I'm not a master too, but I can give some feedback about what I saw.
On the file script.js, you first declare some variables that hold the elements you want to work with on the eventListener to check the email input and then you use these elements on the listener callback.
-
As a best practice, if you don't need to change the value of a variable, prefer to use "const" instead of "let". So, if you are getting the elements, it seems you will not want to replace that variable with other content, so use const for them.
-
On checkInput function, as a good practice I do, is to receive a first parameter as the event parameter. On your case, you are accessing a global event variable, but I think JS or the browser is smart to know that event is the one for the button click
-
Prevent from create a chain of assignments, like: error = document.getElementById("error").innerHTML = "This email is not correct"; The problem is that become hard to read and you are changing the variable declared to be your element. You could have done something like error.innerHTML = "This email is not correct" because error is already declared as your element.
2 -
- @umutbozdagPosted almost 5 years ago
I guess you have forgot to make smaller input field for mobile devices.
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord