Well, here it is, the first blog post, even if it is just an old talk I gave at a San Diego JS' Fundamental JS event two years ago.
A few months before the talk, I was exploring the Chrome DevTools documentation and messing around with the console Web API. It was wild. I created a document noting things I'd like to keep for later reference.
...Which I honestly never used. However, I eventually came back to it while scrambling for topics of my talk and reformed some items into a small site you can check out here:
For quick reference, here are my favorites:
![console.assert example] (https://media.graphcms.com//VTeFLlPlRpKMW57fYc0k) Useful for quickly writing tiny unit tests, the assert method writes an error message to the console if the first argument loosely evaluates to false. If the assertion is true, nothing happens.
I’d argue you’re probably better off using the debugger, but the count method has its uses, like in loops, tracking recursion and function calls. It takes one argument, label, which prepends the count.
Wipes the slate. You can also call
Outputs an error message to the Web Console.
The group methods have been surprisingly useful for tracking data flow, especially with React and Redux. You can even see them implemented under the hood in the popular package, Redux Logger or if you're using Apollo w/GraphQL, Apollo Link Logger . Learn more about Groups
Outputs an informational message to the Web Console. In Firefox and Chrome, a small "i" icon is displayed next to these items in the Web Console's log.
Great for small objects, the table method displays properties and indexes of Objects/Arrays in nice tabular format. This method takes one mandatory argument, which must be an array or an object, and one additional optional argument representing its label.
The trace method prints a stack trace from the point where its called. Like the count method, it’s useful in loops, tracking recursion and function calls.
Thanks for reading!