TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Why is camel case a standard in JavaScript ?

2 pointsby maxencecornetover 8 years ago
Hello,<p>I&#x27;ve always wondered how camel case became a standard, rather than any other convention ?<p>In my opinion, Snake case is much more readable.

3 comments

mtmailover 8 years ago
And other people think camel case is more readable. It&#x27;s a classic flamewar topic which regardless how many arguments are exchanged won&#x27;t find a common ground.
brudgersover 8 years ago
I suspect that it goes back to the days of yore when JavaScript was associated with Java and the orientation of the Java community toward camelCase [it&#x27;s now the Java convention: <a href="http:&#x2F;&#x2F;www.oracle.com&#x2F;technetwork&#x2F;java&#x2F;codeconventions-135099.html" rel="nofollow">http:&#x2F;&#x2F;www.oracle.com&#x2F;technetwork&#x2F;java&#x2F;codeconventions-13509...</a>]<p>I suspect that the reason Java tended toward camelCase is that camelCase was emerging from research at about the time Java was released into the wild and it came along for the ride. Even wilder speculation is that camelCase rose out of Hungarian notation which was among &#x27;best practices&#x27; preceding Java&#x27;s release and Hungarian notation uses lower case prefixes on capitalized descriptions.<p>Three levels of speculation is as far as I will go.
jeanlucasover 8 years ago
camelCase and PascalCase, right? Maybe it comes from the language name (python -&gt; snake, JavaScript -&gt; PascalCase) :-P<p>Now being serious: Actually it is <i>not</i> a standard, since it is not defined like PEP8 kinda defines[1]. Then it goes by what the community uses. From what I&#x27;ve seen, most projects use the camelCase&#x2F;PascalCase, but some like Foundation switched to underscores[2]. There&#x27;s no reason why one is better than the other in terms of readability.<p>On a more serious note: A study[3] suggests that &quot;camel casing leads to higher accuracy among all subjects regardless of training, and those trained in camel casing are able to recognize identifiers in the camel case style faster than identifiers in the underscore style.&quot; There&#x27;s a discussion in this blog post: [4].<p>IMO it&#x27;s too immature to be attached to a style, like it is too immature to think you&#x27;re better than other developers because you use vim.<p>--<p>[1]: <a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0008&#x2F;#naming-conventions" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0008&#x2F;#naming-conventions</a><p>[2]: <a href="http:&#x2F;&#x2F;foundation.zurb.com&#x2F;sites&#x2F;docs&#x2F;v&#x2F;5.5.3&#x2F;upgrading.html#javascript-variable-changes" rel="nofollow">http:&#x2F;&#x2F;foundation.zurb.com&#x2F;sites&#x2F;docs&#x2F;v&#x2F;5.5.3&#x2F;upgrading.html...</a><p>[3]: <a href="http:&#x2F;&#x2F;www.cs.loyola.edu&#x2F;~binkley&#x2F;papers&#x2F;icpc09-clouds.pdf" rel="nofollow">http:&#x2F;&#x2F;www.cs.loyola.edu&#x2F;~binkley&#x2F;papers&#x2F;icpc09-clouds.pdf</a><p>[4]: <a href="https:&#x2F;&#x2F;whathecode.wordpress.com&#x2F;2011&#x2F;02&#x2F;10&#x2F;camelcase-vs-underscores-scientific-showdown&#x2F;" rel="nofollow">https:&#x2F;&#x2F;whathecode.wordpress.com&#x2F;2011&#x2F;02&#x2F;10&#x2F;camelcase-vs-und...</a>