You as a developer must have put an array or object inside a console.log(). Well, there’s a better way of doing it by using console.table() which will structure your code for better readability. You can also sort your table in any way you like without adding any extra piece of code.
console.assert() comes in handy when you want to print some data on the basis of a certain condition, if the assertion is false then it’ll be printed otherwise nothing will be printed in case it’s true.
console.log() gives special treatment to DOM elements, whereas console.dir() does not. This is often useful when trying to see the full representation of the DOM object.
Let’s say you want to see how many times a certain part of your code is being run, console.count() can help you out as it prints the number of times a part of your code for example a function runs.
This method is helpful when you want to group your console data which is similar. We can even do nesting and show relationships among them.
Dealing with bugs in a large and complex codebase where you don’t exactly know the root cause of it can quickly become frustrating and time-consuming. Understanding the code execution flow can help you quickly deal with those bugs and console.trace() helps you deal with those bugs better.
In simple terms, it logs to the console the call stack that exists at the point console.trace() is called.
This isn’t everything. There are so many other console methods that you can read about and leverage in your projects and become super productive. If you’ve come to this point, then I’d invite you to discover more ways to leverage browser DevTools to their full potential.