Advice Generator App (HTML, CSS/SASS, JavaScript, API)

Solution retrospective
This was my first project utilizing an API. I was very excited to start and finally finish this.
Any suggestions on best practices, such as utilizing API's, concise and more convenient SASS coding, and Javascript tips with APIs are very much welcome.
Thank you!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @CallMe-AL
Looks good Nyrell, congrats on finishing your first project utilizing an API!! Looks very good too. Some minor suggestions:
-
I'd wrap your code inside the fetchAdvice() function in a try/catch block to catch errors. You could also add an if statement to see if your response returns 200-209 (ex: if (response.ok){ ...some code }). You might find this video useful for some extra tips: https://www.youtube.com/watch?v=_9vgd9XKlDQ
-
UI-wise the dice remains rotated after I click on it, unless I click off. You might also want to add some styling to let users know there's the 2 second wait between advice (like a countdown timer and a way to prevent clicking the button, or something).
Great job again, keep it up!
-
Join 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