This is because JSLint uses Pratt Parser , a top-down parser, a hollow JavaScript interpreter. If this were truly interpreted, this would not have given you this error.
add_one is an implied global because the parser has not yet encountered this variable, so it assumes that your surrounding code will have this variable. But, if you flip it, then the parser has already stumbled on the add_one variable, and all the peaches and cream add_one
By the way, I noticed a small typo in your closing function line: }()); must be })(); .
source share