Save Your Time To Type Console in JavaScript

Every JavaScript developer has to debug the code and log message in-browser debugging console, this is a very basic way to test the code, but JavaScript developer has to type this extra line in the code many times when coding this is nothing wrong, but you can reduce your development time and provide relief to your fingers by making it shorter and easier.

In this article, I have explained a simple and common method that is rarely used by front-end developers. As we use console.log like this

Console.log(“Testing something…”) Output: Testing something…  
Console.log(4+4) Output: 8
Console.log(!true) Output: false

Now see the shorter version of or method

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

I created a simple function that works the same as console.log(), its name is the log and that contains only three letters. Even you can make it still shorter like give it name only one letter

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

Writing this method will give you ease and comfort:

  • You have not typed all functions just you can type one letter method
  • Typing console.log function is a little longer in front of one letter method or three letter method so you will save time this way
  • You will get relief by not typing extra lines of code


It is used to log the error message in the browser console. This method is helpful to print errors in the browser console, the error message will be highlighted with red color. Below is an example

doSomeThing() => ({ 
  try {
    const stuff = getStuff();
    return do(stuff);
  } catch (err) { 


This method is used to log the warning messages in the browser console.  By default, warnings are highlighted with yellow color. Following is an example,

console.warn(‘write here warning message');

If you need to identify something regarding an element in the console you can use in the browser debug console. Following is an example,‘write here warning message');


If you need to print something in the table in browser debug console you can use below method

console.table(["Mango", "Banana", "Apple"]);

Console.time() and console.timeEnd()

If you are testing a block or function you can use these both functions together time() and consle.timeEnd()

console.time(“String”); console.timeEnd(“String”)


debug() method is an alias for log(), below is an example,