Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the method of the javascript console Console object

Shulou Source: shulou.com Published: 2022-05-31 11:50:38 09月14日 Update

This article mainly explains "what is the method of javascript console Console object". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the method of javascript console Console object".

The js console methods are: assert (), clear (), count (), error (), group (), groupEnd (), info (), log (), table (), time (), timeEnd (), trace (), warn (), etc.

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

Javascript console Console object

The Console object is used for JavaScript debugging.

By default, there is no Console object in the JavaScript native, which is a built-in object provided by the host object (that is, the browser). Used to access the debugging console, the effect may be different in different browsers.

There are two common uses of Console objects:

Displays an error message when the web page code is running.

Provides a command line interface for interacting with web code.

Methods of Console object

Method description the assert () assert method accepts two parameters, the first is an expression and the second is a string. Only if the first parameter is false will the second parameter be output, otherwise there will be no result. Clear () clears all output from the current console and resets the cursor to the first line. Count () is used to count how many times it has been called. When error () outputs information, a red fork is added to the front to indicate the error, and the stack where the error occurred is displayed. Group () is used to group the displayed information, which can be collapsed and expanded. GroupCollapsed () is very similar to the console.group method, except that the content of the group is collapsed rather than expanded when it is first displayed. GroupEnd () ends the inline grouping info () console.log alias, and the output information log () output information table () converts the compound type data into a table display. Time () timing starts timeEnd () timing ends the call to the trace () tracking function warn () outputs a warning message

Common Console debugging commands

Console.log ('hello'); console.info (' information'); console.error ('error'); console.warn ('warning')

Thank you for your reading, the above is the content of "what is the method of javascript console Console object". After the study of this article, I believe you have a deeper understanding of what the method of javascript console Console object is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Object method console control information output parameter content error learning different two code command web page grouping one line that is cursor function Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Microsoft Linux Shulou Technology macOS