I have this async function that I want to turn into a promise
    var myAsyncFunction = function(err, result) {
        if (err) 
            console.log("We got an error");
        console.log("Success");
    };
    myAsyncFunction().then(function () { console.log("promise is working"); });
and I get TypeError: Cannot call method 'then' of undefined.
What is wrong with this code?
 
     
    