Skip to content

Debugging

IT Notes → Javascript @ December 22, 2020

  • Microsoft Script Debugger.
  • Firebug Plugin for Firefox.
  • If you replace debug object by console object for log, debug, info, warn and error it will gracefully degrade to console.log;
  • debug.group( 'start of group' );
    
    debug.log( a );        //Log
    
    debug.debug( b );      //Debug
    
    debug.info( c );       //Information
    
    debug.warn( d );       //Warning
    
    debug.error( e );      //Error
    
    debug.groupEnd();
    
    debug.setLevel(0);     // Ensure no console logging occurs. We can use this function to specify debug level

In short:

  • use console.log in sprintf format.
  • use pointers to function in console.log() to print stack trace of the function.
  • use timer logging using console.time(“abc”) and console.timeEnd(“abc”);
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x