Promise type judgment

var fun = ()=>{
    return new Promise((resolve,reject) => {
        resolve(1)
    })
}

how can I tell that fun () is a Promise object without running fun and cannot modify the fun function?

May.22,2021

does not execute the function, how is it possible to know what type of return value it is? it is not that java or cPP, can declare the return value of the function in advance


Promise itself to determine whether the return value is Promise by judging whether there is a then
if something looks like a duck and tastes like a duck, then he is a duck

.
Menu