What is Promise in Javascript ?

The Promise object represents the eventual completion (or failure) of an asynchronous operation along with its resulting value.

A Promise is a proxy for a value which may or may not be known when the promise is created.

It allows you to associate handlers with an asynchronous action's eventual success value or failure reason.

This enables asynchronous methods return values like synchronous methods: instead of immediately returning final value, the asynchronous method returns a promise to provide the value at some point in the future.



You May Interest

What are Important Events in Javascript ?

JavaScript Concatenating Arrays

What is Difference Between Undefined and Null in Javascript ?

What is Prototype in Javascript ?

JavaScript Adding Elements to Array