Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Practice using API.

P
Wannika123 330

@Wannika123

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

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

@Ikuewumi

Posted

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 an if , or switch statement.

The fetch().then().catch().finally() was a way to bring the try...catch functionality into fetch calls

So, 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 helpful

2

P
Wannika123 330

@Wannika123

Posted

@Ikuewumi Thanks!

0

Please log in to post a comment

Log in with GitHub
Discord logo

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