Asynchronous Javascript

Asynchronous Javascript

·

1 min read

Callback Async-Await Promises

In this article, I try to clear all the question that often comes in newbies of javascript.

What does asynchronous or non-blocking mean?

Asynchronous is the concept of programming which refers to a way of executing tasks or operations concurrently, Without waiting for one task to complete before starting another. This approach allows multiple tasks to run simultaneously making efficient use of system resources and improving the overall response of an application.

Asynchronous helps to prevent blocking the main execution flow of the program, allowing it to continue processing other tasks while waiting for the completion of time-consuming operations.

CODE

  1. callback-based flow ( this rise in complexity of multiple callbacks)

  1. Improve Code Using Promises ( then and catch )

  1. Code Using Async/await

    This example easily shows how the code becomes more readable and manageable when transformed from callback-base flow to promises and then into async await syntax. The async await flow makes the code easier to understand and maintain, as it closely resembles synchronous code white still benefits from the advantage of asynchronous programming.