Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 4
    "A function's first parameter may be named foo, but what is that?" That's why you don't name your parameters "foo", but "repetitions", "parent", and other names that make it obvious what's expected when combined with the function name. Commented Aug 14, 2013 at 13:09
  • 1
    I Have to agree with you on all points. The only problem Javascript really poses with this pattern, is that you are working on mutable data, and as such, you are very likely to mutate state. There is however, a library that gives you access to clojure datastructures in plain javascript, altough i forget what it's called. Passing arguments as an object isn't unheard of either, jquery does this multiple places, but documents what parts of the object they use. Personally though, I would seperate UI-fields and GameLogic-fields, but whatever works for you :) Commented Aug 18, 2013 at 10:54
  • 1
    @SebastianRedl What am I supposed to pass for parent? Is repetitions and array of numbers or strings or does it not matter? Or maybe repetitions is just a number to represent the number of repretitions I want? There's plenty of apis out there that just take an options object. The world is a better place if you name things correctly, but it doesn't guarantee you'll know how to use the api, no questions asked. Commented Aug 23, 2013 at 17:03