What do Synchronous and Asynchronous mean?
Yesterday, I was working on a function in a test runner that executes synchronously. My task was to send a message to Slack. It sounds easy enough, I'm sure I could do it myself with a request POST. However, NPM has packages available. I'll just pull one in.
I tried package after package. None of them worked. They never executed the actual POST. After some troubleshooting, it turns out they're all running in asynchronous mode. This promted me to think, "Do I even know what synchronous and asynchronous mean?" I thought I understood and my original function should have worked.
When you execute something synchronously, you wait for it to finish before moving on to another task. When you execute something asynchronously, you can move on to another task before it finishes.
BUT WHY?!?!?! It seems so counter intuitive. Synchronous should be code executing as the same time and asynchronous should be code executing one line at a time. Not suprisingly, other people were just as confused as I was.