Debugging: values of variables?

  • If I want to do a little development work - which in my case is simply creating a few small functions - some debugging facility is necessary. I know that (at least in Firefox) I can write to the Web Console with the JavaScript function console.log - but are there are other debugging facilities? This might seem like a dumb question, but I've only ever used JavaScript in the context of (Open)JSCAD, so I know nothing about generic JavaScript debugging. How do you step through a script or program, checking values of variables on the way? Add breakpoints?

    As always, many thanks!

  • @z3dev Hey! Thanks for the reply and the welcome, appreciated. I tried @danmarshall app and it works as I was expected. I tried the console.log with the web + debug console in safari and chrome (on mac) but didn't get anything printed.

    It's any other post with other tools for debugging available or it's still in development? (I'm using vsc)

  • @tubaro1 welcome.

    Those messages from console.log() should output to the Console of any of the browsers. Try a simple text message such as console.log(“hi”)

    As for debugging designs, the WEB UI uses worker threads for compiling the designs. This keeps the UI responsive while the compile is running. Good for the general users but not for serious designs, as setting break points and interrogating variables becomes almost impossible.

    If still interested then @danmarshall has put together a small application that does the compile in the main thread. But you’ll need to download and install the application. See

  • Beforehand, my apologies to revive this old thread, I'm currently developing in the v2 of JSCAD, I tried with console.log on a subpart, which successfully compiles but if I open the console (with Chrome on Mac) i'm not able to see any comment or var printed on screen. I'm missing something?

    In a recent post from @z3dev the scope was fixed, I don't know if its related to this, if not, it's any other way to see a log?

    Thanks guys!

  • Same here, I only use console.log in Firefox, and I even used it on some scripts to export data before I knew how to use localStorage.

  • I just use console.log in Chrome(mostly prefer ti vs debug 😄 ), and I think debug breakpoints are not possible due to way user scripts are loaded (I may be wrong on this one).

Log in to reply