Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Base Apparel coming soon page

@ninoschelcher

Desktop design screenshot for the Base Apparel coming soon page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Not a javascript master, let me know what i could improve!

Community feedback

@rafaelmaiach

Posted

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.

  1. 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.

  2. 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

  3. 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
umutbozdag 130

@umutbozdag

Posted

I guess you have forgot to make smaller input field for mobile devices.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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