It’s 2022, Don’t Use the console.log() Anymore

Ming Nguyn
2 min readApr 14, 2022

A quick tip to save your time and make your code look cleaner.

We as JavaScript developers usually use console.log() to test the output or just for fun. Even I can bet that our (including mine) first code was “Hello world” logged in the console.

console.log("Hello World!")

This piece of code has been nostalgic for all fellow JS developers. But now it’s 2022, let’s make it a little handy and comfortable for our fingers.

In this article, I have discussed a simple and common method that has rarely been used by developers.

Let’s get started

As we know, we all use to log the data to the console like this:

console.log("I love js") // I love jsconsole.log(4 + 4) // 8console.log(!true)  // false

Let’s work smartly and efficiently as shown below:

const log = (arg) => console.log(arg)

Here, we have created a function with a shorter name — log relative to console.log(), you can even use a shorter name, something like this:

const l = (arg) => console.log(arg)

So, you might be wondering what’s the benefit of writing code like this? Let’s discuss the benefits.

Benefits

  • Keeps your code clean and slick
  • Improve readability
  • Relief to your fingers, don’t have to write a long thing

Comment more benefits if you can.

Let’s test 🚗

log("Hello world") // Hello world
log(4 + 4) // 8
log(!false) // true
log(Math.PI) // 3.141592653589793

Try it yourself:

Conclusion

So, this was a quick tip to save your time and make your code look cleaner. Let me know in the comments if you will use this tip.

You can try the same thing for the console.info(), console.warn(), console.error().

New journey begin

After the launch of the IFO CAKE Pool, we held our first ever IFO in the 3.0 format. Diviner Protocol ($DPT) IFO was completed with $570M worth of CAKE (at the time of IFO) being committed to the IFO — that’s 950 times overflow! Needless to say, our community loves GameFi and Metaverse projects. And rest assured that our business development bunnies are on the path of bringing you even more.

In the meantime, we appreciate all the feedback and suggestions from our community about how to improve our IFOs. Amazingly, many of the suggestions are already presented on our roadmap for future iterations of the IFO. Remember, it is only phase ONE for now — our chefs are always cooking in the kitchen. More about this below.

--

--