Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style confusing at times, especially for beginners #25

Open
vanhelgen opened this issue Oct 4, 2013 · 0 comments
Open

Code style confusing at times, especially for beginners #25

vanhelgen opened this issue Oct 4, 2013 · 0 comments

Comments

@vanhelgen
Copy link
Contributor

  • Semicolons:
    Many semicolons are ommitted, that's fine by me - I know where they should be - but for beginners (a good part of the target audience?) I think it's confusing to put them in this place but not there ... what about putting all semicolons? It's even inconsistent other than that: e.g. why no semicolon after the last expression within a function like the inner one from once but in mapWith all semicolons are there?
  • Whitespace:
    For my taste the space between function name and argument list is hard to follow - the arguments don't seem to belong - maybe i'm just too acustomed to Crockford's code conventions.
  • Parens on IIFEs:
    I always found that putting the closing paren on IIFEs around the whole expression made it clearer that the thingy belongs together somehow - again that's probably a matter of taste
  • undefined:
    Again, I know that (void 0) is undefined, but to someone who's new to the language - and also to me - it seems overly confusing, why not adapt the style many libraries use:
    (function (undefined) {
        // some code ...
    }());

undefined reads undefined but can not be overridden from somewhere outside, of course there is the chance to modify it accidently within your code ...

I'd be happy to make the modifications in case you want to incorporate some of the ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant