gcd.js
function gcd(a, b) {
if (b === 0) return a;
return gcd(b, a % b);
}
gcd(48, 18);What to watch
Watch the call stack grow with smaller pairs, then unwind with the answer.
Reading gcd (euclid)on a page only gets you so far - code is a process, and the process happens at runtime where you can't normally see it. In NeonFlow, this exact program runs step by step: every call opens a frame, every branch picks a path, and every value moves through memory in front of you. That's the fastest way to actually understand how gcd (euclid) works.
Run gcd (euclid) yourself
Open NeonFlow, paste this code (or any of your own), and scrub through it one step at a time.
Open NeonFlow