Trying to get familiar with async/await
, I've tried the following code in Chrome:
async function f() {
return await $.get('/');
};
var result = f();
but result
doesn't hold the result (string); rather it holds a Promise
which needs to be awaited again. This code does give me the response string:
var response = await $.get('/');
How can I return the actual response string from a function using await?