JSFiddle - React, Tailwind, and code Playground

JavaScript

var jsonPromise = new Promise(function(resolve, reject) {
  // JSON.parse throws an error if you feed it some
  // invalid JSON, so this implicitly rejects:
  resolve(JSON.parse("This ain't JSON"));
});
jsonPromise.then(function (response) {
    console.log("Cast Success", arguments);
}, function (xhrObj) {
    console.log("Exception Failure", arguments);
});