How to create a promise in JavaScript

Syntax
Last updated Dec 17, 2017
new Promise((resolve, reject) => {
  // asynchronous operation

  // then in case of success
  resolve();
  // or
  reject("failure reason");
});