Debugging JavaScript: Beyond console.log()

Suze Shardlow
4 min readApr 20, 2020

If you’re a JavaScript developer, you’ll know about console.log(), but have you heard of console.table(), console.group() or console.assert()?

The very first bug

console.table(), console.group() and console.assert() aren’t as well-known as console.log(), but they are very useful for debugging.

Let’s take a look, using some example data.

Imagine you are running an e-commerce website. You sell a number of different kitchen items.

You store details about these items in objects, within an array named products.

You can see the product ID, product name, the price and whether or not each one is in stock.

You can see that the coffee maker is the only one out of stock.

What happens if we simply console.log(products)?

--

--

Suze Shardlow

Fun, feisty, five foot two. Coder, crafter, choir singer.