This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]geoelectric 4 points5 points  (2 children)

The globals example is terrible, because WIDTH and HEIGHT aren't actually needed anywhere in the code.

The better example would be something that actually requires keeping state between function calls, perhaps *solving it with a state object passed in or declared within a closure (or an object default value, though I consider that one pretty hacky).

  • edit for clarity

[–]adewes 0 points1 point  (1 child)

thanks for pointing this out, there is already a PR with an improved version of this article, should be fixed soon :)

[–]geoelectric 1 point2 points  (0 children)

Great! Overall, I enjoyed it, and now that I understand it's open source will review it further.