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

JavaScript How To Find The Average Of 10 Numbers Using A While Lo ...

Javascript Removing Elements from Array

What is Code Smell in Javascript ?

What is Difference Between Call and Apply Methods in Javascript ?

JavaScript Getting Absolute Value