Hackernoon logoJavaScript Promises for Dummies by@jecelynyeen

JavaScript Promises for Dummies

Jecelyn Yeen Hacker Noon profile picture

@jecelynyeenJecelyn Yeen

Software Architect, Frontend

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:

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.