Skip to content

Tag: async-await

Replace fetch link with html button

This code is designed to take a data from API, convert it to JSON and display it in the HTML page (with a specific design). There are two buttons on the HTML page that are for changing the page (to change the page, the URL sent to fetch needs to be changed by clicking the buttons (which is where my

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: https://caolan.github.io/async/v3/docs.html#queue 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, …

console.log doesn’t wait “await” in async function

I have this code I want console to wait until onload function ends (when x = true), but this doesn’t happen, console returns false and doesn’t wait this is the output: I want an explanation not just the solve Answer You need to turn the dataget function to return a promise which will resolve after…

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 t…