Q:

JS Using onSuccess() syntax

I have some code and I just see to be doing something wrong with the syntax. 
Here is the code:
async mymethod(onSuccess, onFailure) {
    try {
        // Do some here
        onSuccess()
    }
    catch (e) {
        //this was an error
    }
}

What I want to do is its onSuccess() I want to do something. 
Tried:
onSuccess((function() {
    // Do something
}))

But there seems to be a syntax error. 
How do I use onSuccess() and do something with it? 

A:

You're missing the function keyword:
async function mymethod(onSuccess, onFailure) {
    try {
        // Do some here
        onSuccess()
    }
    catch (e) {
        //this was an error
        onFailure()
    }
}

mymethod(() => alert('success'), () => alert('failure'));

