JavaScript Promises for Dummies

Written by jecelynyeen | Published 2016/12/02
Tech Story Tags: javascript | rxjs | promises | async | es6

TLDRvia the TL;DR App

Javascript Promises are not difficult. However, lots of people find it a little bit hard to understand at the beginning. Therefore, I would like to write down the way I understand promise, in a dummy way.

Understanding Promises

A Promise in short:

“Imagine you are a kid. Your mom promises you that she’ll get you a new phone next week.”

You don’t know if you will get that phone until next week. Your mom can either really buy you a brand new phone, or stand you up and withhold the phone if she is not happy :(.

That is a promise. A promise has 3 states. They are:

  1. Promise is pending: You don’t know if you will get that phone until next week.
  2. Promise is resolved: Your mom really buy you a brand new phone.
  3. Promise is rejected: You don’t get a new phone because your mom is not happy.

Full article available in my Scotch:

JavaScript Promises for Dummies_Get to know JavaScript Promises better. Javascript Promises are not difficult. However, lots of people find it a little…_scotch.io


Published by HackerNoon on 2016/12/02