Js console output method (detailed description) console. log (object [, object,...])
Output a message on the console. If multiple parameters exist, the output parameters are separated by spaces.
The first parameter can be a string that contains the formatted placeholder output, for example:
Console. log ("The % s jumped over % d tall buildings", animal, count );
The above example can be replaced with the following code without formatting placeholder output:
Console. log ("The", animal, "jumped over", count, "tall buildings ");
In addition, these two methods can be used in combination. If a placeholder is formatted and the number of parameters provided is greater than the number of placeholders, redundant parameters are appended to the string by space separation, like:
Console. log ("I am % s and I have:", myName, thing1, thing2, thing3 );
If the parameter is a Javascript object, the output on the console is not a static text, but an interactive hyperlink. Click the hyperlink to view the HTML, CSS, Script, and DOM windows of the object, you can use the formatted string % o to replace Javascript objects.
Console. log ("Body tag is % o", document. body );
Format the string list:
Create a timer named name, call console. timeEnd (name) to stop the timer, and output the consumed time (milliseconds ).
Console. timeEnd (nam)