DEV Community

Cover image for Debugging beyond console.log() in JavaScript

Debugging beyond console.log() in JavaScript

Gautam Vaja on June 05, 2024

Most JavaScript developers are familiar with the basic console.log(). However, the console API offers many other methods that can be incredibly use...
Collapse
 
krunalrana profile image
Krunal Rana

console.log(Object.keys(console))

Try this you will get list of functions associate with console function,

Alternat methods :

Using Object.getOwnPropertyNames()
console.log(Object.getOwnPropertyNames(console));

Using for...in loop

for (let key in console) {
console.log(key);
}

*Note : * this is not just console function we can find almost all properties of any JS function

Image description

Collapse
 
mvaja13 profile image
Gautam Vaja

Great

Collapse
 
shricodev profile image
Shrijal Acharya

Never knew about console.time(). Thank you for sharing this. 🙌

Collapse
 
anmolbaranwal profile image
Anmol Baranwal

Yep! Didn't know a lot of stuff. Console hides a lot!
I think using a separator after each point would give a better structure for the post.

Collapse
 
mvaja13 profile image
Gautam Vaja

Thanks for the advice

Collapse
 
yusuke050 profile image
Lin Fan-Chiang

Thank you for sharing. I plan to use console.group() and console.groupEnd() for my next implementation.

Collapse
 
mvaja13 profile image
Gautam Vaja

Yeah go ahead.

Collapse
 
sudipmondal2002 profile image
SUDIP MONDAL

Insightful

Collapse
 
alanoberto profile image
Alan Oberto

Very Nice article, I was not aware of at least half of it

Collapse
 
krunalrana profile image
Krunal Rana

console.time() and console.timeEnd()

is new for me #Helpfull #greateinsight

Collapse
 
emmijozzy profile image
OGUNSUYI JOSEPH OLUWASEUN

Nice

Collapse
 
markwilliams21 profile image
Mark

Thanks for sharing this with us! Keep up the good work.

If you want to know more about java then do visit here

Collapse
 
albertobarrago profile image
alBz • Edited

really nice Article ;-)

Collapse
 
saikumar2121 profile image
Saikumar

it's better to use logging libraries like errsole because you can get insights about your application and see your logs all in one place in the UI

Collapse
 
davidbosah profile image
David Bosah

Nice

Collapse
 
abhiram010 profile image
Adapaka Abhiram

Thank you for sharing, Very insightful!

Collapse
 
pramon18 profile image
pramon18

The console.counter() one is very useful.