Asynchronous programming
When it comes to code execution, A normal JavaScript program sits on the processor to get executed. a simple for loop will stay on the processor side until it’s fully computed for our program flow to continue it’s normal path. This is called Synchronous code. Synchronous code runs line after line, one after another for as long as the processor is processing them. Most part of our program will be built in this way.
The slow part
Sometimes, you want to do more extra things, this being talk to the internet, accessing the file system or perform some other slow tasks. Most of these tasks take time and are usually very slow compared to the time it takes you to run a for loop. the moment you want to access some files on your computer, if it’s to take 2seconds then you don’t want your processor to stay idle.
With asynchronous programing you will write your codes in a style that will not only leave the asynchronous task to run in the background, but also allow your processor to work on some other part of your program while these operations are being computed.