Design comparison
Solution retrospective
Spent a couple of months learning the basics of Javascript, APIs etc. and attempted this based on what I've learned. If there's a quicker or better way to do this, please let me know!
Community feedback
- @EmanueleGuriniPosted over 2 years ago
Hi @mattyoung7, well done, but reload doesn't works on FireFox: seem that FF caching the fetch result.
I found this solution on StackOverflow (https://stackoverflow.com/questions/72567690/ui-is-not-updating-on-click-event-that-triggers-a-fetch-on-firefox-developer) but the problem is that property called count is always incremented by one, and, if you start a new session, advice is always the same in a row.
To avoid the same advice in a row, as you can see from my solution, I create a new Random number, and I use it only if my script detects firefox browser.
My solution: https://github.com/EmanueleGurini/js-advicegenerator/blob/master/js/main.js
ps. why am I using 224 as max number? Advices are 224.
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