Design comparison
Solution retrospective
I'm glad that I finish another challenge.
What specific areas of your project would you like help with?When fetching the data, what is the difference between:
try {
...
} catch { ... }
and
fetch(...)
.then(...)
.then(...)
.catch(...)
And which situation to use it?
P.S. As the advice #117 is no longer the same as in the design file, I made it generate random quote when loaded. And I think that's how it's supposed to be.
Community feedback
- @IkuewumiPosted 8 months ago
Hi 👋 @Wannika123, Great project, really well done
About your question, the
try...catch...finally
block was the first one made, it is just another tool for control flow, like anif
, orswitch
statement.The
fetch().then().catch().finally()
was a way to bring thetry...catch
functionality intofetch
callsSo, they do the same thing, provide functions for code to run if it fails, preventing the error from spilling out into the outer scope
Happy Coding, Ayobami
Marked as helpful3
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