Skip to content

Instantly share code, notes, and snippets.

@mikedotexe
Forked from soquel/shorten_console_log.js
Created April 15, 2013 20:53

Revisions

  1. @soquel soquel created this gist Feb 27, 2013.
    14 changes: 14 additions & 0 deletions shorten_console_log.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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 );
    }
    }