
Design comparison
Solution retrospective
Thank you guys to check my really first project with js! I have a question if somebody would check my work, about the Javascript file. In the index.js i save the selected vote (1 or 2 or etc) with addEventListener, and a function that store the value in a new variable to bring it in the second html page.. well, i was wondering if it was possible to do it without the eventListener, if there is another way to store a variable from a selected button after a click. This way is really short, but even if i used it i don't really understand it (i copied from a project a did during the js course). I mean, for me the addEventListener should be used to add an event, such as play a sound, show an image, text, or something that happen (the event) after the click, but in this case i used it only to take out a value and put it inside a variable, is there a more "proper" way to do it? Thanks everybody for the suggestions and happy coding!!
Community feedback
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