In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use console tab in Firebug", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use console tab in Firebug" this article.
1. Log record of Firefox (Logging in Firefox).
With the recording method of Console, we can no longer use the annoying alert or [xss_clean] methods for debugging. Firebug provides five types of logs:
◆ console.log: record one line of information without any icon prompt
◆ console.debug: record one line of information with a hyperlink that can be linked to the place where the statement is called
◆ console.error (): writes an error message to the console with error icon display and highlighted code link
◆ console.info (): writes prompt messages to the console, with information icon display and highlighted code links
◆ console.warn (): writes a warning message to the console, with warning icon display and highlighted code link
Consle print strings support string substitution, which is similar to printf ("% s", a) in c. The supported types include:
% s string, string
% dline% I Integer
% f floating point
% o object
If you use% o, the object will be represented by a green hyperlink, which will take you to the DOM view.
2. Grouping (Grouping).
If there is a lot of information in a certain category, grouping is conducive to logical division. It is easy to use, see the code.
Function consoleGroup () {var groupname = "Group 1"; console.group ("Message group% s", groupname); console.log ("This is the 1 message in% s", groupname); console.log ("This is the 2 message in% s", groupname); console.log ("This is the 3 message in% s", groupname); console.groupEnd () Goupname = "Group 2"; console.group ("Message group% s", goupname); console.log ("This is the 1 message in% s", goupname); var subgroupname = "Sub group 1"; console.group ("Message group% s", subgroupname); console.log ("This is the 1 message in% s", subgroupname) Console.log ("This is the 2 message in s", subgroupname); console.log ("This is the 3 message in s", subgroupname); console.groupEnd (); console.log ("This is the 2 message in s", goupname); console.groupEnd ();}
3. Console.dir and console.dirxml
Console.dir can print out all the methods and properties of an object. This method is undoubtedly very useful. We no longer need the support of methods like object.toString. As long as we have firebug, it is easy to view objects.
At the same time, we can also print out the elements in the page as an object, but you have to be careful, because this will output a lot of information, and you may get lost in the complicated information and can't find the items you need.
We can put this large amount of information into a group by grouping, so that it can be logically clearer.
Function consoleDir () {function Car () {this.Model = "Old Model"; this.getManu = function () {return "Toyota";}} var objCar = new Car (); console.dir (objCar); console.dir (zoo) Var groupname = "Css Style"; console.group ("The button Style", groupname); console.dir (document.getElementById ('consoledir'). Style, groupname); console.groupEnd ();}
4. Assertion (console.assert ()).
Console.assert () can be used to determine whether an expression is correct, and if it is wrong, it prints an error message in the console window.
5. Tracking (console.trace ()).
Console.trace () is a very interesting feature. Let's take a look at the official explanation: print a stack trace of the Javascript execution time.
This function prints out the path information from the starting point to the end point when the program is executed. For example, if we want to know when and how a function is executed, we put console.trace () in the function, and we can see the path where the function is executed. This function is very useful when debugging other people's source code.
6. Timing (Timing).
Console.time (timeName) can be used for timing, which is especially useful when we need to know the efficiency of code execution, so we don't have to build our own wheels.
Function consoleTime () {var timeName = "timer1"; console.time (timeName); var a = 0; for (var I = 0; I < 100; iTunes +) {for (var j = 0; j < 100; jacks +) {/ / console.log ('Hello world'); a = a + 1 }} console.log ("a =% d", a); console.timeEnd (timeName);}
7. Javascript Analyzer (Javascript Profiler).
We can analyze the execution of the Javascript code by code console.profile ('profileName') or by clicking the Profiler tag. This feature is somewhat similar to console.time (), which can help us evaluate the performance of the code, but can provide more detailed information than console.time ().
There are three ways to call Javascript profiler. One is to write an analysis script in the code, the other is to click the profile tag, and * can also type a command at the command line to execute. After execution, you can see the detailed output, which is described below:
Function Column: displays the name of the called function
Call Column: displays the number of calls
Percent Column: displays the time consumed ratio
Own Time: displays the time that statements within the function are executed, excluding the time when other functions are called
Time Column: displays the execution time of the function from start to finish
Avg Column: average time. Avg = Own / Call
Min & Max Column: show minimum and * time
File Column: the file where the function is located
8. Other options.
There is an Options option on the far right of Console Tab, where you can define the errors that need to be displayed, and the content is easy to understand, so I won't say much here. One thing is that after Firebug1.3, there are more Show Chrome Errors and Show Chrome Message.
The above is all the contents of the article "how to use console tab in Firebug". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.