JSFiddle - React, Tailwind, and code Playground

by jashwant

JavaScript

const myPromise = new Promise((resolve, reject) => {
  var user = apiCall();
  if(user) {
      reolve(user)
  }
  else {
	  reject('Something happened')
  }
});


console.log('hello');

myPromise
  .then(function(user) {
    return JSON.parse()
  }) 
  .catch(function(err) {
    console.log(err);
  })
  .finally(function () {
  
  })

console.log('world');