๐——๐—ฎ๐˜† ๐Ÿฎ๐Ÿณ ๐—ผ๐—ณ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป๐—ถ๐—ป๐—ด ๐— ๐—˜๐—ฅ๐—ก ๐—ฆ๐˜๐—ฎ๐—ฐ๐—ธ

I studied Asynchronous JavaScript today.

Until now, my code ran sequentially. One line finished before the next line started. This approach blocks the browser during heavy tasks.

I learned how JavaScript manages time-consuming tasks like API calls or database queries.

Synchronous vs. Asynchronous:

I practiced with the setTimeout utility. I set a delay in milliseconds. I noticed that code written after a timeout runs before the timeout finishes. This shows how non-blocking code works.

I also encountered Callback Hell.

Callbacks are functions passed as arguments. When you nest many callbacks to handle sequential tasks, the code becomes a mess. It is hard to read and hard to debug.

To understand this, I built a simulation:

The resulting structure looked like a pyramid. This messy code shows why developers moved to better tools.

Tomorrow, I move to the next step:

Did nested callbacks confuse you when you first learned them? Do you still see old callback code in professional projects?

Source: https://dev.to/ali_hamza_589ec7b3eb6688d/day-27-of-learning-mern-stack-1cgj