Playground
JavaScript · runs in an isolated thread · saved in this browser
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Predict the order, then press Run console.log('script start') setTimeout(() => console.log('timeout'), 0) Promise.resolve() .then(() => console.log('promise 1')) .then(() => console.log('promise 2')) queueMicrotask(() => console.log('microtask')) ;(async () => { console.log('async function body') await null console.log('after await') })() console.log('script end')
Press Control or Command with Enter to run the code. Tab inserts spaces; press Escape and then Tab to leave the editor.
Console
Press Run to execute the code. Logs, errors and timings appear here.