Design comparison
SolutionDesign
Solution retrospective
Any suggestions and tips to improve the solution are welcome :)
Community feedback
- @fazzaamiarsoPosted over 2 years ago
Hello Kadheryna! Nice work!
I have some tips for you.
- On accessibility you can wrap both
section
inmain
elements. This ensures all of your contents are inside a landmark. - In
submitValue
, you can do a guard clause to make it cleaner. Guard clause means if the condition is not valid, don't do anything. - To do string concatenation, you can use template literal which is easier to write. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Here is the implementations.
const submitValue = () => { if (btnValue === undefined) return; // guard clause with early return; firstBox.style.display = "none"; secondBox.style.display = "flex"; result.innerHTML = `You selected ${btnValue} out of 5`; //template literals };
I hope it helps! Cheers!
Marked as helpful1 - On accessibility you can wrap both
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