JavaScript Console Object

JavaScript Console Object

In JavaScript, a console is an object that provides the access to the web browser’s debugging console. The console object is a property of the window object. The console object can be accessed with either Window.Console or Console i.e.: Window.Console.Log() or Console.Log()

The Console object is present only if there is a debugging tool supported by the browser. console.log() is used to display JavaScript values in the console window under the debugging tool of the browser. It is used to write log messages at runtime. For a better understanding, please have a look at the below example:

a = 15;
b = 16;
c = a + b;
Methods of Console Objects in JavaScript:

The JavaScript console object provides several different methods:

  1. assert()
  2. clear()
  3. count()
  4. countReset()
  5. debug()
  6. dir()
  7. dirxml()
  8. error()
  9. group()
  10. groupCollapsed()
  11. groupEnd()
  12. info()
  13. log()
  14. table()
  15. time()
  16. timeEnd()
  17. timeLog()
  18. trace()
  19. warn()

We will look at all these methods one by one in our next article.

In the next article, I am going to discuss JavaScript Console Assert() Method with Examples. Here, in this article, I try to explain JavaScript Console Object. I hope this JavaScript Console Object article will help you with your need. I would like to have your feedback. Please post your feedback, question, or comments about this article.

Leave a Reply

Your email address will not be published. Required fields are marked *