Skip to content

Instantly share code, notes, and snippets.

@DavidQL
Created July 27, 2011 03:19
Show Gist options
  • Save DavidQL/1108594 to your computer and use it in GitHub Desktop.
Save DavidQL/1108594 to your computer and use it in GitHub Desktop.
(function() {
var page_count = 0,
up_page_count = function () {
page_count++;
};
if ( up_page_count() ) {
console.log('I will never run');
}
})();
@shinout
Copy link

shinout commented Jul 27, 2011

This is because the function "up_page_count" doesn't return any value.
Why not doing

update_page_count = function() {
return page_count++
};
I suppose this is what you really want to check, unless there's no meaning to set a variable "page_count".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment