First,
commands to display information
The most common is the console.log.
Second,
placeholder
Console The above concentration supports printf placeholder format, supported placeholders are: characters (%s), integers (%d or%i), floating-point numbers (%f), and objects (%o)
Effect:
Third,
Information Grouping
Effect:
Four,
View information about an object
Console.dir () can display all properties and methods of an object.
Effect:
Five,
Display the contents of a node
Console.dirxml () is used to display the Html/xml code contained in a node of a Web page.
Effect:
Six,
determine if a variable is true
Console.assert () is used to determine whether an expression or variable is true. If the result is no, a corresponding message is output in the console and an exception is thrown.
1 is a value of 0, is true, and the second is false, displaying an error message on the console
Seven,
trace the call path of the function.
Console.trace () is used to track the call path of a function.
Console output Information:
Eight,
Chronograph function
Console.time () and Console.timeend () are used to display the elapsed time of the code.
Run Time is 38.84ms
Nine,
Console.profile ()
The performance analysis
Performance analysis (Profiler) is the analysis of the various parts of the running time, to find out the bottleneck, the method used is Console.profile ().
Output
This article Dwqs reprint link: https://github.com/dwqs/blog/issues/32
Nine console commands to make JS debugging easier