sync, timeout, promise, sync
Synchronous logs run first, then the promise microtask, then the timeout macrotask.
log(1); setTimeout(2); Promise.then(3); log(4) -> 1, 4, 3, 2Build a sequence or paste supported JavaScript statements to model synchronous code, microtasks, timers, animation callbacks, and Node.js nextTick step by step.
Standard interview puzzle: synchronous console.log, setTimeout(0), Promise.then, and final log.
Interactive step-by-step model of the Call Stack, Microtask Queue, Task Queue, animation callbacks, and Node.js nextTick.
Evaluating the synchronous script on the Call Stack.
Fill in the values, paste your text, or upload the file this tool works with.
Most tools update live as you type; a few use a single button. Either way, the result appears right on this page.
Copy, download, or share what the tool produces — you're always in control of the output.
The JavaScript Event Loop Simulator models execution order for synchronous statements, Promise and queueMicrotask jobs, setTimeout callbacks, requestAnimationFrame, and Node.js process.nextTick without executing the code.
Choose a preset, build a sequence, or enter supported JavaScript statements to inspect a deterministic model of the call stack and task queues step by step.
The editor recognizes the supported statement patterns and turns them into labels for a local ordering model. It does not execute arbitrary JavaScript, resolve variables, run network requests, or reproduce exceptions and return values.
Timer delays are used to establish deterministic relative order rather than simulate wall-clock time. requestAnimationFrame depends on a real browser's rendering opportunities, and process.nextTick belongs to Node.js, so those presets explain separate runtime concepts instead of claiming one universal timeline.
Synchronous logs run first, then the promise microtask, then the timeout macrotask.
log(1); setTimeout(2); Promise.then(3); log(4) -> 1, 4, 3, 2Statements and labels stay in browser memory for this page. They are not uploaded, stored by the tool, or executed as JavaScript; only aggregate tool interactions can be counted by consent-based analytics.
Because the microtask checkpoint drains queued Promise callbacks before the event loop selects the next timer task. A 0 ms delay makes the timer eligible; it does not interrupt the current task or its microtasks.
Yes, as a modeled continuation: the async/await preset and supported lines containing await represent the work after await as a microtask. The tool does not execute the async function or resolve its value.
No. The core synchronous and microtask checkpoint order is represented, but timer timing, rendering opportunities, and Node.js phases involve runtime details outside this deterministic model. The rAF and process.nextTick presets should be read as separate browser and Node.js examples.
The simulator sorts macrotasks by delay and keeps source order for ties, matching the stable ordering used in the model.
No. It recognizes supported console.log, setTimeout, Promise/.then, queueMicrotask, requestAnimationFrame, process.nextTick, and await patterns, then converts them into model steps. Unsupported JavaScript is treated as a label rather than executed.
Generate standards-compliant UUID v4 and GUID identifiers individually or in bulk.
Format, minify, and validate JSON and XML, and convert between JSON and YAML.
Create QR codes and read QR images locally.
Encode and decode text using Base64 locally.
Encode and decode URLs in separate tabs, with batch and recursive options.
Convert Unix timestamps (seconds and milliseconds) to dates and vice versa.
Encode and decode HTML entities safely.
Test regular expressions and preview replacements.
Decode JWT header and payload locally.
Build, validate, and decode 5-field cron expressions with next run times.