Created
July 27, 2011 03:19
-
-
Save DavidQL/1108594 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var page_count = 0, | |
up_page_count = function () { | |
page_count++; | |
}; | |
if ( up_page_count() ) { | |
console.log('I will never run'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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".