Skip to content

Instantly share code, notes, and snippets.

@soquel
Created February 27, 2013 22:01
Show Gist options
  • Save soquel/5052196 to your computer and use it in GitHub Desktop.
Save soquel/5052196 to your computer and use it in GitHub Desktop.
Shorten console.log() to l()
function l() {
try {
// this works in Firefox/Opera
console.log.apply( this, arguments );
} catch (e) {
// this is for Chrome/IE
var args = [], i = 0;
while( i++ < arguments.length )
args.push('arg' + i);
new Function( args, 'console.log(' + args.join( ',' ) + ')' ).
apply( null, arguments );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment