1. command to display information
Console.log (' Hello ');
Console.info (' information ');
Console.error (' error ');
Console.warn (' warning ');
2. Placeholder
Console the above-mentioned centralization supports printf placeholder formats, supported placeholders are: characters (%s), integers (%d or%i), floating-point numbers (%f), and Objects (%o).
Console.log ("%d years%d months%d days", 2011,3,26);
3. Information grouping
Console.group ("first group");
Console.log ("First Group One");
Console.log ("First group, second article");
Console.groupend ();
Console.group ("second group");
Console.log ("second group first");
Console.log ("second group, second section");
Console.groupend ();
4. View information about an object
Console.dir () can display all properties and methods of an object.
5. Display the contents of a node
Console.dirxml () is used to display the Html/xml code contained in a node of a Web page.
6. Determine if the 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.
7, tracing the function of the call trajectory.
Console.trace () is used to track the call path of a function.
8. Chronograph function
Console.time () and Console.timeend () are used to display the elapsed time of the code.
Console.time ("console timer");
for (Var i=0;i<1000;i++) {
for (Var j=0;j<1000;j++) {}
}
Console.timeend ("console timer");
9. Performance analysis of Console.profile ()
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 ().
JS Debug Tool Console command