More Options of printing errors other than console.log in Javascript

More Options of printing errors other than console.log in Javascript

Most of us have used console.log() to print values in the browser. console.log() is just one method of console object. There are several other methods that are very useful. By using console.log() you can print values of the variables which you have used in your code. Often this can be used to debug if the right value is being passed in your code.


1. console.error

Console.error method is useful while testing code. It is used to log errors to the browser console. By default , the error message will be highlighted with the red color.

1. console.warn()

Like last one this method is also useful while testing code. Usually, it helps in throwing warnings to the console. By default the warning message will be highlighted with yellow color.

3. console.table()

This method generates a table inside a console, for better readability. A table will be automatically generated for an array or an object.

Did you like our works?

We are known for Website Development and Website Designing, along with Android iOS application development in Mumbai, India. Please write us what you think, we would like to hear it from you