DEV Community


How to use the fetch API with and without async/await

Liz Lam
I love open source, coffee and tinkering.
Updated on ・1 min read

Sometimes the best way to explain something to someone is to just show them an example. This was the case when a couple of coworkers had some confusion around using async/await.

After verbally explaining, I opened up my web console and gave them a quick example. This seemed to clarify their understanding.

I will share the example here in case it's helpful to anyone else.

Fetch API example

SIDE NOTE: This also made me think about how just playing around in the web console is a great way to learn of JavaScript. It's also an easy way to share knowledge because anyone can just copy what you have into their own web console.

Discussion (0)

Forem Open with the Forem app