Async Patterns

JavaScript is single threaded.
Synchronous program flow is one statement at a time and statements are executed in order. This has blocking.


What we are trying to achieve is to have code that looks synchronous (but is actually running asynchronous code)



Asynchronous Program Flow

Asynchronous program flow means that more than one statement can be executed simultaneously. This is non-blocking
JavaScript has a number of built-in functions that are executed asynchronously by default

setTimeout 
XMLHttpRequest method
requestAnimationFrame



© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopNext