Skip to content

Tag: async-await

Javascript serial queue using async?

I have the following code: When I run the code above I get this: To do that I referenced this link: Could someone help me understand why the “serial” nature of the queue is not respected here? I set concurrency to 1 when I created serialQueue but, it looks like the queue isn’t really serializing the execution of the

await does not affect async function

Hi i’m fairly new to javascript and I’m having a problem with my async function inside the AddEventListener method that is not awaiting the fetch result, so when i try to console.log(track_info.tracks) it prints out undefined. Answer Solution You need to add an await to the call of getTrack. var track_info = await getTrack(urlTrack); Helpful Tips How to await fetch

Calling async function in .map() (React)

I’m trying to iterate over IDs ( and for each of them fetch some data (based on those IDs) from API (getBPM()). I’m pretty sure it’s connected with Promises and I’m not very fluent with these yet. Here’s the code: I’ve tried some things, but couldn’t get it to work. I’d appreciate any kind of help Answer When you call

Getting an array of Promises after async await

i’m trying to create an array of the daily forecast mapping over an array with cities. I’m trying to map over the array of the cities making an api call for each one of them once the page loads. I keep on getting an array of Promises such as this : Favorite Page component: Service with the api call :