JSFiddle - React, Tailwind, and code Playground

by Soviut

JavaScript

let cancel = () => null

const p = new Promise(function(resolve, reject) {
  cancel = function() {
    reject('blah')
  }

  setTimeout(function() {
  	resolve('ding!')
  }, 3000)
})
.then(res => console.log(res))

cancel()