JSFiddle - React, Tailwind, and code Playground

by Abdul Ahmad

JavaScript

function async() {
	return new Promise((res, rej) => {
  	rej('error');
  });
}

function doSomething() {
  return async().then(r => {
		return r;
  });
}

function doAnother() {
	doSomething().then(r => {
  	console.log(r);
  }).catch(e => {
  	console.error('addAnother');
  	console.error(e);
  });
}

doAnother();