@Galielo-App
Posted
Hello Aurora!
Awesome build, just a few tips for the javascript:
- You're executing an event listener the first time the window loads. In this case, your javascript is pretty small, so you shouldn't have performance problems. But this is something that you should try to avoid. A solution would be
form.addEventListener('submit', () => ...)
, this will execute the code only when the form is submitted. - Is a very good practice to make each function to do something different. I strongly suggest isolating each function, here is an example:
function validateField() {
const pattern = (regex here)
const inputValue = input.value
inputValue.match(pattern) ? validField() : notValidField()
}
//then you create these functions that will render error and stuff
For any question or suggestion feel free to ask :)
Upvote my comment if I was helpful and happy coding :)
@Auro-93
Posted
@Galielo-App Thanks so much for the tips! These days I'm reviewing the code and I will treasure the advice for the next projects :)!