Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How JavaScript outputs from the console

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

This article mainly explains "how to output JavaScript from the console". The content in 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 how to output JavaScript from the console.

Output method: 1, use "console.log" statement to output information; 2, use "console.info" statement to output information; 3, use "console.warn (warning)" statement to output warning information; 4, use "console.error" statement.

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

In JavaScript, you can use the methods of the Console object to output from the console.

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.

When the method describes the output information of the instance error (), a red fork is added to the front to indicate the error, and the stack where the error occurred is displayed. Console.error ("Error:% s (% I)", "Server is not responding", 500) info () console.log alias, output information console.info (") log () output information console.log (") warn () output warning information console.warn ("warning")

In Chrome browsers, for example, we can open the Console window by pressing F12 or Control+Shift+i (PC platform) / Alt+Command+i (Mac platform).

Thank you for your reading, the above is the content of "how to output JavaScript from the console". After the study of this article, I believe you have a deeper understanding of how to output JavaScript from the console, 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: Output information console control statements methods learning code content objects platforms web pages errors two aliases can be passed at the same time commands stacks instances Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS OPPO Reno Docker Apple