Mark As Completed Discussion

#3 - Promises

Promise Introduction

Javascript promise is an object that acts as a proxy for an asynchronous function that is supposed to complete at some point. Promise supports the non-blocking asynchronous operations in javascript. So, with promises, the code doesn’t block, and the promise eventually returns a value.

A promise may exist in any of the three states.

  • Pending: Initial state; neither fulfilled nor rejected
  • Fulfilled: When the operation completes successfully
  • Rejected: When the operation fails
Source

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\

JAVASCRIPT
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment