DEV Community

Cover image for Want to Turn the JavaScript Console Into a Mean Console? Now, You Can!
Antonello Zanini for Writech

Posted on • Updated on

Want to Turn the JavaScript Console Into a Mean Console? Now, You Can!

Donato Rimenti did it again! If you are not familiar with him, he is the developer behind the React PokeDom and GomorraSQL projects. The first one allows you to catch Pokédom hidden in the DOM of a web page, while the latter has more than 1.2k stars on GitHub and enables you to write SQL queries in Neapolitan.

This time, he came up with Mean Console. The motto behind this library?

"Let the console express how it feels about your coding mistakes!"

Have you ever wondered what the console would tell you if it was a human being frustrated by your countless coding mistakes? Well, this is exactly what this new project is all about!

Let's now understand what Mean Console is and how it works.

What Is Mean Console?

Mean Console is an npm library that enables the JavaScript console to tell you what it honestly thinks about your code. Every time the console.error() gets called, the library will add a special comment for you to the error message.

Some of the funniest messages it will tell you are:

  • "Some drink from the fountain of knowledge; you only gargled"

  • "I'm jealous of all the people who haven't read your code"

  • "Aw, it's so cute when you try to code things you don't understand"

Technically speaking, it simply overrides console.error() by adding custom insult extraction logic.

When to use Mean Console? The scenarios are endless! You could secretly install it to see the reaction of your colleagues or have a fun pair programming session, competing to see who makes the console madder.

How to Make the JavaScript Console Speak Truthfully About Your Coding Skills

Integrating Mean Console into your code is not difficult. First, add @aurasphere/mean-console to your project dependencies with:

npm install @aurasphere/mean-console
Enter fullscreen mode Exit fullscreen mode

Then, import it into your code with the line below:

import "@aurasphere/mean-console"
Enter fullscreen mode Exit fullscreen mode

Et voilà! You will now receive an honest message from the console whenever console.error is invoked.

Conclusion

In this article, we looked at Mean Console, a npm library that allows the JavaScript console to give you an honest opinion about your code. Making coding into a fun experience isn't that easy, but this library definitely pulls it off!

Thanks for reading! I hope you found this article helpful.


The post "Want to Turn the JavaScript Console Into a Mean Console? Now, You Can!" appeared first on Writech.

Top comments (0)