All courses
0/23 steps
Lesson 1 · async / await
Step 1/ 2
Real AI calls take time. JavaScript handles this with **async functions** — they always return a Promise, and you use await to pause until the result arrives.
In this sandbox await works at the top level — no wrapper needed.
Write an async function getStatus() that returns the string "online". Then await it and console.log the result.
Example
async function greet() {
return "Hello!";
}
const msg = await greet();
console.log(msg); // Hello!main.js
Console
Press Check to run your code…
Lesson 1 · async / await
Step 1/ 2
Real AI calls take time. JavaScript handles this with **async functions** — they always return a Promise, and you use await to pause until the result arrives.
In this sandbox await works at the top level — no wrapper needed.
Write an async function getStatus() that returns the string "online". Then await it and console.log the result.
Example
async function greet() {
return "Hello!";
}
const msg = await greet();
console.log(msg); // Hello!
