Design comparison
Solution retrospective
Wondering if there are any tips for optimizing loading the advice slip on the page? Or anything that would make this smoother? Thanks!
Community feedback
- @catherineisonlinePosted almost 2 years ago
Cool solution!
To improve semantics, make sure to wrap the entire code in the main tag not including header or footer tags. It will help to remove report issues and improve accessibility as well.
IF THIS WAS HELPFUL PLEASE MARK IT AS HELPFUL 🤩
Marked as helpful1@rachelprPosted almost 2 years ago@catherineisonline Thanks for the suggestion, I'll do some refactoring to improve semantics!
0 - @Mattvp21Posted almost 2 years ago
Hi Rachel,
I have a few tips.
-You may want to write the getAdvice function as an async/await function -Instead of doing window.reload on the dice button, I suggest adding an event listener to look for a click that will listen for your generateAdvice function -I suggest using textContent instead of innerHTML. innerHTML can open a website to cross-site-scripting attacks and shouldn't be used.
- It's good practice to put things like document.querySelector.ononon into a global variable. I would do something like const adviceCard = document.querySelector('.advice-card). It's easier to manage when projects become large.
I hope this is helpful and happy coding! :)
-Matt
Marked as helpful1@rachelprPosted almost 2 years ago@Mattvp21 Thanks for the advice (heh), I'll do some refactoring, don't want to leave this vulnerable to XSS attacks!
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