How to Apply CSS to Javascript Console Output

How to Apply CSS to Javascript Console Output

The easiest way to make debugging JS in your browser super smooth and easy on the eyes.

This is something I didn’t know about for a long time, actually. If you’re reading this, you probably don’t know about it yet. Or maybe you’re just looking for a refresher.

Either way, applying styles to JavaScript console output is super simple, extremely easy to learn, and it will provide results immediately if you do any amount of debugging in your browser.

The Situation

You’ve been at it all day. You have 3 different browsers open. You’re hunting some bug — it doesn’t matter what the bug is, all that matters is the sheer amount of console.log() output that is going on.

Every time the page goes through a render loop in whatever framework you’re working with, 20 lines pop up in the console. You have to continually parse through all of them to find the line you’re interested in. One of them is related to variableX, one is related to variableY, one is displaying the results of apiCallA, one is displaying the results of apiCallB, and 16 of them are from someone else’s ugly mess.

You get the picture. Your eyes are tired. Your brain is fried. Wouldn’t it be nice if you could format these in a way that your eyes could easily scan? It’s all just blending into itself now, and you keep reading the wrong value on each render, and you’re having to go back and forth between your monitors and different browsers and…

Perhaps you’d like all of your local state variables to be displayed in lime green, just so they pop out at you from in between all the other black text. Or maybe you’d like the console output to be in bold red when something is NaN or undefined.

You don’t even really care at this point. Anything is better than nothing.

Well, here’s how you do just that. And it’s definitely better than nothing — it’s how to apply any CSS to your console output.

css javascript tips

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

top 30 Python Tips and Tricks for Beginners

In this post, we'll learn top 30 Python Tips and Tricks for Beginners

Stunning CSS & JavaScript Effects | Top CSS & JavaScript Animation

Stunning CSS & Javascript Effects | Top CSS & Javascript Animation

The essential JavaScript concepts that you should understand

The essential JavaScript concepts that you should understand - For successful developing and to pass a work interview

TIP Calculator using HTML, CSS & Javascript

We take a deep dive into how to code a tip calculator using HTML, CSS & Javascript. This tutorial can be considered as a beginner tutorial. We look into form inputs, styling form inputs in CSS & HTML while using Javascript to create the interactivity needed to calculate tips.

Hire CSS Developer

Want to develop a website or re-design using CSS Development? We build a website and we implemented CSS successfully if you are planning to **[Hire CSS Developer](https://hourlydeveloper.io/hire-dedicated-css-developer/ "Hire CSS Developer")**...