Asynchronicity: An Intro to Asynchrony in JavaScript

Asynchronicity: An Intro to Asynchrony in JavaScript

In this example, have AssistantGetMail() is an asynchronous function. In other words, it’s a function that JavaScript knows may take awhile, so while it’s running, JavaScript will go ahead and move on to the next line of code.

Here’s a scenario: imagine you’re the CEO of a wildly successful new company. You have a luxury office at the very top of a high-rise in your city of choice. You are absolutely drowning in money and fame. Unfortunately, you are also drowning in work. Now, you have three things to do before you attend a meeting with your employees in an hour. First, you need to create a spreadsheet for the company’s budget. Second, you need to have your assistant pick up any company mail from the mailbox downstairs. Third, you need to email your new budget to the company’s investors.

So you get to work in Excel, and after forty minutes you’ve got your monthly budget planned out. You call your assistant, and tell them to go down to the first floor and get your mail. And then you wait… and wait… and wait. Twenty minutes later, your assistant comes back, dripping with sweat. The elevators are out of order, and they’ve just had to jog down and up ten flights of stairs. You now have to rush to your meeting, and your stockholders won’t receive the budget until afterwards!

Except, that’s not what a hard-working entrepreneur would have done, is it? Sitting there twiddling your thumbs while your assistant did your errands would be an enormous waste of time. While they were braving the staircase, you could just as easily have emailed out your budget, and had time to spare!

Congratulations, snazzy new business exec! You’ve just uncovered a concept called asynchrony.

Image for post

Sorry; no relation to the Police album

To start to tie this back into JavaScript, let’s try illustrating the previous list of tasks in pseudo-code.

const investors = ["Warren Buffet", "Bill Gates", "Tony Stark", "another famous rich person"]

investors.forEach(investor => {

web-development coding javascript flatiron-school asynchronous

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Why Web Development is Important for your Business

With the rapid development in technology, the old ways to do business have changed completely. A lot more advanced and developed ways are ...

Important Reasons to Hire a Professional Web Development Company

    You name the business and I will tell you how web development can help you promote your business. If it is a startup or you seeking some...

6 Ways to Practice Your Coding Skills and Grow Your Career as a JavaScript Developer

6 min read ... Some of the highest-paid JavaScript developers make close to $500k/year ... actually need to learn many languages in the course of their career to ... Learn concepts professional developers need to advance their careers ...

Web Design and Development Services

Get Best out from Web Design and Development Services from Vinew Technologies,We have a dedicated team of experienced and knowledgeable web developers, designers and testers. Therefore, we have proficiency in analyzing, developing and designing the necessity of intricate Website Development projects.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.