2

CamelCase is a convention and not a specification, so when there is a doubt it is common sense to stick to the language specification or implementation's naming convention.

The doubt I came across several times is acronyms. As this answer and this answer states it seems that Microsoft and .NET usually goes for camelCase for acronyms as in XmlDocument apart for 2 letters acronyms as in System.IO whereas Java prefers to always go for capitalized acronyms like SAXParser. Id, I think, is a different thing because it is an abbreviation of identifier rather than an acronym.

That being said, I would like to apply one of those conventions to JavaScript, so I started thinking that it would go towards the Java standard, but I found some weird things like window.XMLHttpRequest which mixes everything up.

Why is XML capitalized while HTTP is camelCased ? What is the common convention for JavaScript ?

M. Justin
  • 14,487
  • 7
  • 91
  • 130
Rayjax
  • 7,494
  • 11
  • 56
  • 82
  • I don't think that there's a common language convention. E.g. `XMLHTTPBindingCodec` goes for all caps.... – msp Mar 02 '16 at 14:29
  • @msparer yes, well, this is Java and they always go for all caps so ti seems ok. JavaScript seems to be a lot more confusing – Rayjax Mar 02 '16 at 15:48

0 Answers0