WeCodeAcademy

Timers and Asynchronous Code

setTimeout runs code later. JavaScript keeps running other code while it waits. A promise with async/await makes waiting read top to bottom.

Examplejavascript
Open in editor »
Quick check

What prints second in the example?

Your turn: write the code

Print start, schedule later to print after 100 ms with setTimeout, then print end. The output order must be start, end, later.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.