JSFiddle - React, Tailwind, and code Playground

by Kawaljit Singh

JavaScript

(async () => {
  const somePromise = new Promise((resolve, reject) => resolve("some resolved value"));

  const canPayWithApplePay =  () => {
    if (true) {
      // return the outcome of promise
       return  somePromise.then(value => {
        if (value) {
          return true
        } else {
          return false
        }
      })
    }
    return false
  }

  const a = await canPayWithApplePay();

  console.log(a)
})()