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

How to Handle Exceptions in JavaScript ?

What is Difference Between Javascript and ECMAScript ?

JavaScript Taking the Square Root of a Number

JavaScript Getting Absolute Value

What are Control Flow Statements in Javascript ?