Site Owners Forums - Webmaster Forums

Site Owners Forums - Webmaster Forums (http://siteownersforums.com/index.php)
-   Programming General (http://siteownersforums.com/forumdisplay.php?f=44)
-   -   Javascript Console Methods You Must Know (http://siteownersforums.com/showthread.php?t=983161)

sahithya 02-20-2023 11:03 PM

Javascript Console Methods You Must Know
 
Console.table()
This function takes one mandatory argument data, which must be an array or an object, and one additional optional parameter columns.
It logs data as a table. Each element in the array (or enumerable property if data is an object) will be a row in the table.

Console.group()
The *console.group()* method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until *console.groupEnd()* is called.
You can use nested groups to help organize your output by visually associating related messages.

Console.assert()
The *console.assert()* method writes an error message to the console if the assertion is false. If the assertion is true, nothing happens.

Console.trace()
Use the *console.trace* method to output a stack trace.
This can be useful for understanding the flow of execution in your code and for identifying where a particular log message is coming from.

Console.dir()
The method console.dir() displays an interactive list of the properties of the specified JavaScript object. The output is presented as a hierarchical listing with disclosure triangles that let you see the contents of child objects.

Console.count()
The *console.count()* method logs the number of times that this particular call to count() has been called.

Console.profile()
Use the *console.profile*and *console.profileEnd* methods to measure the performance of a block of code.
This can be useful for identifying performance bottlenecks and for optimizing your code for speed and efficiency.


All times are GMT -7. The time now is 09:54 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.