console object
Provides a way to send messages to the Microsoft Visual Studio or client console.
Syntax
var myConsole = window.console;
DOM Information
Inheritance Hierarchy
The console does not inherit from any class or interface.
Members
The console object has these types of members:
- Methods
Methods
The console object has these methods.
Method | Description |
---|---|
assert | Sends a message to the console if the expression provided evaluates to false. The message text color is red and it is prefaced by an error icon. |
clear | Clears messages from the console. |
count | Create an incrementable counter that prints its value to the console. Use different countTitle parameters to create different counters. |
debug | An alias of console.log. |
dir | Prints the properties of an object to the console. |
dirxml | Logs an XML node object to the console. |
error | Sends an error "message" to the console. The message text color is red and it is prefaced by an error icon. |
group | Begins a collapsible group of console output. Initially displays expanded. |
groupCollapsed | Begins a collapsible group of console output. Initially displays collapsed. |
groupEnd | Ends the grouping started with a group or groupCollapsed method. |
info | Sends an informational "message" to the console. The message is prefaced by an information icon. |
log | Sends a log "message" to the console. The message is prefaced by the string "LOG". |
msIsIndependentlyComposed | Retrieves a Boolean value indicating whether the element is independently composed. |
profile | Starts recording profile information under the optional title provided. This command is equivalent to clicking the Start profiling button on the F12 tools Profile tab. |
profileEnd | Stops recording profile information under the last report title. |
time | Starts a timer. If you do not specify a name parameter, the name "default" will be used. |
timeEnd | Ends a timer that was set using console.time() and logs the elapsed time to the console. If you do not specify a name parameter, the name "default" will be used. |
trace | Logs a stack trace to the console. |
warn | Sends a warning message to the console. The message is prefaced by the warning icon. |