Today's browsers often have a developer tool to help developers build more efficient websites.
The developer tool has a console window (console window) for outputting some debugging information, and with this tool you can finally say goodbye to debugging JavaScript with alert. And the console's function is much more than just outputting a little bit of information about where it is now, it can also identify different kinds of information and provide hyperlinks to the corresponding code.
The developer tool uses this object to output work information from inside the application to the console console by loading an object named console into the global namespace. The following is a method of the 7 console objects, which are described in the comments:
<! DOCTYPE html><html> <head> <meta content="text/html; CHARSET=GBK " http-equiv=" Content-type "> <title>Console.log</title> </head> <body> <script>Console.log ("Test-log"); //Output a message to the console console.debug ("Test-debug"); //output information, and there will be a hyperlink linked to code console.info ("Test-info"); //Output a message icon and information Console.warn ("Test-warn"); //Output a warning icon and warning message console.error ("Test-error"); //output an incorrect icon and error message Console.assert (3<2); //Assertion errors are displayed on the console and are not displayed correctly //console.clear (); Clear the console information </script> </body></html>
Console of the developer tool "HTML5 and CSS3 Basics"