But most of the time it's more a matter of thinking things through an extra time rather than poring over debug prints.
When thinking things through and drawing debug info as colours both fail I usually load up a graphics debugger such as RenderDoc. You might think that wasn't an option here, but if I were to develop something this intricate for Shadertoy I'd definitely develop it as a standalone app in regular OpenGL first and then port it.
Unfortunely good debuging tools for 3D Web API isn't a priority even after 10 years, and same applies to WebGPU roadmap.
Btw you'll enjoy learning that lots of microchip / embedded programming happens on chips that don't have printf at all (even when connected to a computer) and also no debugging capabilities. People tend to connect a LED to an unused pin for some 1-bit printf debugging and that's all you got.
I mostly use browser debuggers and even then I only use a small fraction of their capabilities, but honestly they are just more effective that printing values.
Let's say a variable is being overwritten and you can't figure out why. It could be some dark corner of the code you missed or it could even be memory corruption. A debugger will let you put a conditional breakpoint on that memory address being written, which will then give you all the context needed to see what's going on. This has helped me solve quite a few really tricky bugs.
There's also the simple case of debugging a tricky crash. Before learning to use a debugger (some twenty years ago) I had to do printf with all kinds of local variables guessing at what might be the cause. Attaching a debugger you mostly just run the program, it gets an access violation, and the debugger breaks showing you the generated exception, the stack, the exact statement which caused the crash (though this mostly requires debugging with optimizations turned off), and you can just hover over any variable to check their values. Most crash bugs which would have been very tricky with printf now take seconds to diagnose because you have the full context of the program just as it was when it crashed, right at your fingertips.
Since this is a comment on a shader program there's also the matter of GPU debuggers which I just have to mention in order to say: you can't really do typical printf debugging for most shaders and graphics debuggers are like magic.
Using the debugger is a skill. Don't knock it till you try it.
Pascal, x86 assembly, arm assembly, Python ... and sometimes even a mix of them running together.
Why would you even ask?