Console.log (‘Hello World!’); Console.info (‘Something Happend …’) Console.warn (‘Something Strange Happend …); console.error (‘ Something Horrible Happened … ‘);
If you want to know where the message is printing, use
From now on, I will teach you some you don't know. Skills, let you become old drivers!1. Console.Trace ()
console.trace ()to get the StackTrace of the data you want to print. .
2. Console.time () && console.TimeEnd ()
console.TimeEnd () to end the timing, the console will print a time difference between twice.
If you find that performance problems are difficult to analyze, it may also be considered whether there isTo exist, you can use
Console.Memory (Note Memory is the properties of Console, not a function) to view the current stack.
Fundebug helps you better debug, welcome to try! 4. Console.profile (‘ProfileName’) & console.profilend (‘ProfileName’)
Although it is not a standard approach, it is not widely accepted. You can use these two commands to start and stop Profiling. This helps you make precise profile in your code. Not relying on manual mouse click. You can find the just profile in the browser consoleJavacript Profiler
Sometimes, in order to record a function or how many times is repeated, it can be repeated. Use Console.count (‘?’)to record. Every time you execute it, you will be automatically added.
6. Console.assert (False, “Log ME!”)
You can use
console.assert Output messages under false conditions instead of using IF-ELSE.
7. Console.group (‘group’) & console.groupend (‘group’)
If you want to make a format for the printed log Correlation, you can useConsole.Group ()
Console.groupend () . Use console.group to aggregate into groups, and form a nesting hierarchy. That example:
8. String SubstitutionsYou can use
Console.logprint variable (% s = String,% I = INTEGER,% o = Object,% f = float).
9. Console.clear ()
10. Console.table ()The last pressure axis! You can use
Console.Table ()to print the object in the form of a table.