Photo by Cytonn Photography on Unsplash

If you want to be proficient in JavaScript, it is imperative to learn Asynchronous JS. One of the first words that you will hear in Asynchronous JS is Promises.

It is not possible to explain all of the key concepts in a single article. So this will be a 4 part series that helps you lay the foundation of the major concepts in Promises.

This article will explain why Promises were introduced and what it offers to the world of Asynchronous JS. …

What will be the output of the following code?

Will it throw an error, or will it execute?

It will execute and we will give the output- Printing: 1

In JavaScript, you can invoke a function with any number of arguments.

As we are aware, TypeScript brings compile-time type checking to JS.

If we change the language to TypeScript and then try to compile the file, we will get the following error:

Up until this point, we have learned

  1. Why promises were introduced?
  2. Promise fundamentals. How to create and consume a promise?
  3. Promise chaining

Now we will look into some of the other methods in Promise API and when to use them.


The Promise.all() method takes an iterable of promises as the input, and returns a single Promise

This returned promise will only resolve when all of the input promises have resolved and its value will be an array of the results of the input promises.

If any of the input promises reject or throws an error, the returned promise will immediately…

Photo by Aida L on Unsplash

In parts 1 and 2 of this series, we understood Why promises were introduced, What promises are, and how to create them. In this part, we will build on that by understanding how we can chain multiple promises together or simply Promise chaining.

This is an important concept to understand, one which is at the base of further asynchronous JS concepts like async/await.

Up until this point, we have only talked about a single asynchronous task being carried out. But what if, we have to do multiple asynchronous tasks in succession, each after the previous one finishes?

To understand that…

In part 1 of this series, we have understood why Promises were introduced. We know that the Promise API was introduced as a better paradigm to handle Asynchronous JS. Here we will understand What are promises and How to create promises with a simple example and we will, later on, look at a more practical example.

So what is a promise?

Imagine one morning at work, your colleague calls you up and asks you to do a favor. He needs you to go to the office parking lot and check whether there is an open spot. …

After upgrading my projects to Angular v9, while I was trying to debug the application using ng.probe, I kept getting the following error

Abdu Manaz C A

Loves JS, java and anything tech.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store