×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: C++
Posted by: Frank Czap
Added: Jun 22, 2017 3:38 AM
Views: 2420
  1.  
  2. Diagnose and Log to Console
  3.  
  4.  
  5. By Paul Bakaus
  6. Open Web Developer Advocate at Google • Tools, Performance, Animation, UX
  7.  
  8. By Meggin Kearney
  9. Meggin is a Tech Writer
  10.  
  11.  
  12. By Flavio Copes
  13. Flavio is a Full Stack Developer
  14.  Console logging is a powerful way to inspect what your page or application does. Let's start with console.log() and explore other advanced usage.
  15. TL;DR
  16.  
  17. Use console.log() for basic logging
  18. Use console.error() and console.warn() for eye-catching stuff
  19. Use console.group() and console.groupEnd() to group related messages and avoid clutter
  20. Use console.assert() to show conditional error messages
  21. Writing to the console
  22.  
  23. Use the console.log() method for any basic logging to the console. It takes one or more expressions as parameters and writes their current values to the console, concatenating multiple parameters into a space-delimited line.
  24.  
  25. Executing this line of code in your JavaScript:
  26.  
  27. console.log("Node count:", a.childNodes.length, "and the current time is:", Date.now());
  28. Will output this in the Console: