#Java script

14 messages · Page 1 of 1 (latest)

velvet dawn
#

How long did it take you to study the topic "asynchronous functions"?

candid rock
#

that will depend on how deep you get into it. for a shallow understanding for at least know how to use it, it should take even less than 1 hour

velvet dawn
#

Thanks

lean aurora
#

In it's simplest terms
use it when the function requires to wait for data that could be delayed
-# think of api or database calls

lean aurora
#

for a more in depth explanation
JavaScript is single threated meaning it can at best use 1 core of the cpu
this is a performance issue because that means it wouldn't be able to multi task
to solve this issue they created "asynchronous" so it can rapidly switch tasks back and fourth
as this is the closest thing to multi tasking on a single threat
"async" is basically just a flag telling JS to expect data it needs to wait on
while "await" is just a flag telling JS "go do something else but come back once in a while for any data" but really fast

velvet dawn
#

Thank you

velvet dawn
lean aurora
lean aurora
#

You're still welcome and we are ready to help but this is a huge leap people usually learn to swim in water that is less deep
Take it slow and steady you dont learn everything in a day and dont need to either

low willow
#

I just ran into this video yesterday. It's pretty good explanation why JavaScript has async functions (with await) or rather it explains why they are even a thing.

velvet dawn
#

Thanks