Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created May 9, 2017 14:06
Show Gist options
  • Save gskachkov/b0c61c98a70f17bc7c7b3dc0d9e9a563 to your computer and use it in GitHub Desktop.
Save gskachkov/b0c61c98a70f17bc7c7b3dc0d9e9a563 to your computer and use it in GitHub Desktop.
Async function declaration
async function foo () {
const result = await fetch("https://randomuser.me/api/?results=10", { method: "GET" });
return result;
}
const boo = async function () {
return await fetch("https://randomuser.me/api/?results=10", { method: "GET" });
};
foo();
boo();
function foobar() {
const result = await fetch("https://randomuser.me/api/?results=10", { method: "GET" });
return result;
}
// SyntaxError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment