Monday, December 22, 2014

Chrome's console.table

Google Chrome's console.table( ) is a great feature.  The following example code (source) shows how powerful and useful this feature of Chrome can be.

var arr = [];
for( var i = 0; i < 256; i++ ){
  var char = String.fromCharCode( i );
  if( encodeURI( char ) !== encodeURIComponent( char )){
    arr.push({  
      character: char, 
      encodeURI: encodeURI( char ),
      encodeURIComponent: encodeURIComponent( char )
    });
  }
}
console.table( arr );

It produces the following table within the console of Chrome.
** Note: to enter line break in the Chrome's console, use [Shift] + [Enter] keys.