I have noticed that most Javascript methods (framework and custom) start with lowercase letters. Is there a reason and/or benefit to this?
Asked
Active
Viewed 188 times
1
-
http://stackoverflow.com/questions/1564398/javascript-method-naming-lowercase-vs-uppercase – mplungjan Jan 05 '11 at 17:59
2 Answers
1
There's no technical reason. It's about readability, tradition, similarity to existing code. Consistency leads to readability, and arbitrary divergence stands out for no good reason.

Paul Roub
- 36,322
- 27
- 84
- 93
-
Additionaly, the convention is to start constructor functions with an uppercase letter. This mirrors the conventions in Java and other OO langauges. – OrangeDog Jan 05 '11 at 17:59
-
I'm not knocking your answer, but if I play devil's advocate I might say that mixed case for the first letter of the words that make up a method name makes for more difficult readability. Also, working without source control is a bad tradition many still follow, but that doesn't make it good to follow. If most existing code for a platform is poorly formed, why emulate it? – NoAlias Jan 05 '11 at 22:26
-
Obviously, diverging from norm when there's a good reason to do so is a *very* good thing. But capitalization is pretty subjective, so absent a compelling benefit (other than personal preference), why add gratuitous differences? – Paul Roub Jan 08 '11 at 02:21
0
In any case-sensitive language, it's especially important to be consistent about how you case variables. But starting with lower-vs-upper is just an idiom that's evolved in the community.

Gabe Moothart
- 31,211
- 14
- 77
- 99