Skip to content

Instantly share code, notes, and snippets.

@davestewart
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save davestewart/9771415 to your computer and use it in GitHub Desktop.

Select an option

Save davestewart/9771415 to your computer and use it in GitHub Desktop.
Console.log shortcut. Mainly useful for sticking in a jQuery .each() loop...
// function
function log(){ console.log.apply(console, Array.prototype.slice.call(arguments, 0)); }
// as a shortcut
log(1,2,3);
// 1 2 3
// as a proxy
$('section').each(log);
/*
0 <section id=​"home" class=​"tab-pane">​…​</section>
1 <section id=​"library" class=​"tab-pane">​…​</section>
2 <section id=​"workspace" class=​"tab-pane active">​…​</section>
3 <section id=​"editor" style>​…​</section>
4 <section id=​"input-output" class=​"element">​…​</section>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment