async function task1() { const res = await fetch('https://httpbin.org/get') .then(res => res.json()) .then(data => console.log(data)) return res; } async function task2() { // Do something with Fetch result console.log("Done handling the Fetch result!"); } async function executeTasks() { await task1(); await task2(); console.log("Task 3"); } executeTasks();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter