Uncaught SyntaxError: Unexpected token function (async)

2.5k views Asked by At

I am trying to execute the following function using async/await, but I getting the following error:

Uncaught SyntaxError: Unexpected token function

Using the following code:

async function getCsrfToken() {
    let token = '';
    await $.get(domain + '/mobile/token', result => {
        token = result;
    });
    return token;
}

My Editor isn't complaining about the syntax, but Chrome within Crosswalk is complaining about it. Am I doing something wrong or do I need to do something within crosswalk?

0

There are 0 answers