JSFiddle - React, Tailwind, and code Playground

by Rishabh Sharma

JavaScript

function foo(x) {
	return new Promise(function (resolve, reject) {
  	reject(42);
  });
}

var p = foo(42);

p.then(function(res) {
	console.log(res);
})
.catch(function(err) {
	console.log(err);
});