window.console or console object is under-rated with only
console.log() being used most of the time. However, the console object comes with a lot of advanced features.
In this article, we will be discussing the functions available on the console that can be handy at times.
Besides console.log(), there are a lot of other methods also available. You can try looking for the suggestions list in the browser’s console.
We can also concatenate multiple values using console.log(). Simply call console.log() with multiple parameters and all the values will be concatenated.
You can even pass multiple objects and the browser’s console will show them side by side.
Following are some of the examples of concatenation with console.log:
While console.log() can be used to print an object, we can also use console.table() to pretty print an object in the form of a table.
Just pass the object to print the object in a more readable format.
Notice, how it prints the values for the nested object.
It is used to print warning messages in the browser’s console.
It is used to print error messages in the console.
This can be used to calculate the time elapsed by our code to execute.
Before starting the execution of any operation, start the timer with console.time(‘TIMER_NAME’) and after the execution of the code, end the timer with console.timeEnd(‘TIMER_NAME’).
As soon as you call the timeEnd function, the elapsed time will get printed in the console.
The timer name should be same for time() and timeEnd()
This command is used to clear the console.
Running the last command resulted in the console being cleared with the following message.
Thank you for reading !
Does your business need an interactive website or app?
The technology used to develop the overall app by the developers from WebClues Infotech is at par with the latest available technology.
For more inquiry click here https://bit.ly/31eZyDZ
Book Free Interview: https://bit.ly/3dDShFg
console.log() . These libraries can be used in your next Node, React, Angular, or Vue projects. So let us see what are those libraries and how to use them.
With 15+ years of domain expertise, we have successfully delivered 13800+ projects and have successfully garnered 6800+ happy customers with 97%+ client retention rate.