Skip to content

Instantly share code, notes, and snippets.

@davidjbeveridge
Created April 23, 2012 16:23
Show Gist options
  • Save davidjbeveridge/2472058 to your computer and use it in GitHub Desktop.
Save davidjbeveridge/2472058 to your computer and use it in GitHub Desktop.
My Coffee Script test. I am trying to figure out what is wrong with my scoping to make it not increment.
jQuery ->
count = 0
$("a").click (e) ->
e.preventDefault()
alert("Hello World #{++count}")
jQuery(function() {
var count;
count = 0;
return $("a").click(function(e) {
e.preventDefault();
return alert("Hello World " + (++count));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment