Debugging Code in Deno

Learn to debug a Deno program using inspect and the inspect-brk flag.

Debugging with the inspect-brk flag

Even when we’re following best practices and doing our best to write simple, clean code, any relevant program is very likely to need debugging once in a while.

Mastering the ability to quickly run and debug code is one of the best ways to improve our learning curve for any technology. This skill makes it easy to test and understand how stuff works by trial and error and fast experimentation.

Let’s learn how we can debug our code.

The first step is to create a second program. Let’s add a couple of variables that we can inspect later. The main objective of this program is to return the current time. We’ll be using the already known Date object to do this. Let’s call this file get-current-time.js, like so:

Get hands-on with 1200+ tech skills courses.