I saw that putting async
in front of a JS function returns a Promise.
What I have now:
async function asyncTest(p) {
return p;
}
let www = asyncTest(1)
console.log('www ', www); // returns Promise {<fulfilled>: 1}, see image
I was wondering if I could use this to have resolved and rejected in an async
, acting like a typical new Promise((resolved, rejected)....
What I would like to do:
async function asyncTest(p, (resolved, rejected)=>{
resolved(p);
})
let www = asyncTest(1)
console.log('www ', www); // I want it to return 1
Is this even possible?