Skip to main content

JavaScript code visualizer

Visualize

See your code run, step by step

The fastest way to understand loops, recursion, lists and objects, and to find bugs.

  • The line that just ran and the line that runs next, highlighted in your code.
  • A plain-English note on every step: which variable changed, which function was called, what it returned.
  • The call stack as cards, so recursion is easy to follow: every call is numbered and shows its own variables.
  • Arrays as indexed boxes, objects, Maps and Sets as tables, with arrows from each variable to what it points to.
  • When the code fails, the error explained in simple words, with a button to jump to the step where it happened.
  • Play, pause, go back and forward, or drag the slider. Works on phones too.
Just want to run code? Open the online JavaScript compiler

What it supports

JavaScript ES2024, run in your browser

  • Modern JavaScript: let and const, arrow functions, classes, arrays, objects, Map and Set.
  • console.log prints numbers, text, arrays and objects clearly.
  • Type what prompt() reads in Input, one value per line.
  • Runs stop after 5 seconds, so a loop that never ends cannot freeze anything.
  • It runs entirely in your browser: nothing is sent anywhere.

Input

How to read input in JavaScript

Programs that read from the keyboard get their input from the Input box. Type one value per line, then press Run. The program reads the lines in order, just as it would from a keyboard.

const n = Number(prompt());           // first line
const [a, b] = readline().split(" ").map(Number); // two numbers on one line
const rest = require("fs").readFileSync(0, "utf8"); // everything

Questions

Frequently asked questions

What is a JavaScript code visualizer?
A tool that runs your JavaScript program one line at a time and draws what happens: the line that ran, every variable, the call stack and the data your variables point to, with a short note on each step. It shows what a program does instead of only what it prints.
How do I visualize my own JavaScript code?
Paste or type your program in the editor, add any input in the Input box, then press Visualize. Use play, the arrow buttons or the slider to move through the steps, forwards or backwards.
Is it free?
Yes, it is free. It works on laptops, tablets and phones. Create a free account to save your progress and practise with lessons and coding problems.
How is this different from the online compiler?
They share the same editor. The online JavaScript compiler is for running programs and seeing their output; the visualizer opens with an example built to show the step-by-step view and explains each step. You can press Run or Visualize on either page.
Why does a long program stop being traced part-way?
Each trace records a limited number of steps so it stays fast. Programs with very long loops are cut off with a note; use smaller input to see the whole run.

Learn

Learn JavaScript step by step

Press Visualize on any program to watch it run line by line: the fastest way to understand loops, functions and objects.