ProjektID

View Original

Console methods

See this content in the original post

assert

Outputs an error message to the console if the assertion is false. If the assertion is true, nothing happens.

See this content in the original post

clear

Clears the console, removing all previous messages.

count

Logs the number of times that this particular call to count() has been called with the given label.

countReset

Resets the count for the specified label.

See this content in the original post

debug

Outputs a message to the console with a low priority, similar to log, but can be filtered differently based on the console's settings.

dir

Displays an interactive list of the properties of the specified JavaScript object. This list lets you explore the object in a structured format.

dirxml

Displays an XML/HTML element representation of the specified object if possible.

See this content in the original post

error

Outputs an error message to the console, typically used for logging error messages.

See this content in the original post

group

Creates a new inline group in the console. Subsequent messages will be indented by an additional level, until groupEnd is called.

groupCollapsed

Similar to group, but creates a collapsed group which can be expanded by the user.

groupEnd

Exits the current inline group.

See this content in the original post

info

Outputs an informational message to the console, similar to log, but can be styled differently by the console.

See this content in the original post

log

Outputs a general message to the console. This is the most common method used for logging general information.

See this content in the original post

profile

Starts recording a performance profile. This profile can be used to analyze performance issues.

profileEnd

Stops recording a performance profile.

See this content in the original post

table

Displays data as a table in the console, making it easier to view and analyze array or object data.

time

Starts a timer with a specified label. This timer can be used to measure how long an operation takes.

timeEnd

Stops the timer started with time() and logs the elapsed time to the console.

timeLog

Logs the current value of the timer created with time() without stopping it.

trace

Outputs a stack trace to the console, which can be useful for debugging to see the path taken to reach a certain point in code.

See this content in the original post

warn

Outputs a warning message to the console, typically used for logging warnings or potential issues.


Thank you for taking the time to read this article. Hopefully, this has provided you with insight to assist you with your business.


See this content in the original post