Design comparison
Solution retrospective
Hello everybody!
Finished my second challenge in JavaScript. This one was interesting! Add some problems with SCSS, for JavaScript it was alright. However, if anybody did this challenge, I will gladly take any advice on the JS (mainly if there is a way to reduce the amount of document.getElementById).
Community feedback
- @achrustowskiPosted about 2 years ago
Hi Leo!
I really like your solution, logic works as expected and everything does it's job as it should, well done! :)
As for reducing the amount of
getElementById
I don't think there is any other way if you're using vanilla JavaScript (I've done my solution similar way to yours). Only thing I'd change in order to make your life easier IF you had to edit your JS code, I'd putthrowErrorMessage
selectors into variables same as you did for buttons and inputs.Great job!
Marked as helpful1@SouiciaPosted about 2 years ago@achrustowski Thanks for answering! And yes, I kinda guessed there shouldn't be a way to getElementById in bulks mainly when they have different functions. I just thought if a page has 50 of them, it would be a pain to write all of them, so I just asked in case :D. And you're correct about the throwErrorMessage function. It would have made a less bulky function. I was just really tired of writing new variables up there haha!
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