paint-brush
Making Debugging Easy With Console Wranglingby@razchiriac
404 reads
404 reads

Making Debugging Easy With Console Wrangling

by RazAugust 14th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Have you ever used the console to log the console? No? You should try it. The console will show you what the console can do. Today we’ll talk about two of the functions available on the console object:`console.table()` and `console.trace()` Let’s say we have two objects: carA = {make: 'Ford', model: 'F150', year: '2018', color: 'white'}const carB = 'F250'const CarA = 'Ford'const.

Company Mentioned

Mention Thumbnail
featured image - Making Debugging Easy With Console Wrangling
Raz HackerNoon profile picture


Have you ever console logged the console


So, you know the good ol’ console.log()

Well, that’s not the only thing the console can do, it’s only the most basic.


Have you ever used the console to log the console? No? You should try it.


The console will show you what the console can do.



Today we’ll talk about two of the functions available on the console object:

console.table() and console.trace()


Let’s say we have two objects:


const carA = {make: 'Ford', model: 'F150', year: '2018', color: 'white'}
const carB = {make: 'Ford', model: 'F250', year: '2016', color: 'blue'}


If we wanted to do some debugging and had to print these objects out to the console we could use console.log() but it won’t look too nice.


Look how neat console.table() can display the two objects:


You can even sort the two rows by column just by clicking on the headers!


One other console function we’ll talk about today is console.trace(). This will output a stack trace to the console.


And that’s all for today.


I hope I’ve helped make your debugging a little less boring. Now go show off your new console skills in your next stand-up.


Cheers!