Saturday, April 13, 2024
184
rated 0 times [  187] [ 3]  / answers: 1 / hits: 174200  / 15 Years ago, thu, may 28, 2009, 12:00:00

I know there is a lot of controversy (maybe not controversy, but arguments at least) about which naming convention is the best for JavaScript.


How do you name your variables, functions, objects and such?


I’ll leave my own thoughts on this out, as I haven’t been doing JavaScript for long (a couple of years, only), and I just got a request to create a document with naming conventions to be used in our projects at work. So I’ve been looking (googling) around, and there are so many different opinions.


The books I’ve read on JavaScript also use different naming conventions themselves, but they all agree on one bit: “Find what suits you, and stick to it.” But now that I’ve read so much around, I found that I like some of the other methods a bit better than what I’m used to now.


More From » naming-conventions

 Answers
72

I follow Douglas Crockford's code conventions for JavaScript. I also use his JSLint tool to validate following those conventions.


[#99439] Sunday, May 24, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
domeniccolti

Total Points: 276
Total Questions: 98
Total Answers: 93

Location: India
Member since Fri, May 13, 2022
2 Years ago
domeniccolti questions
Mon, Oct 18, 21, 00:00, 3 Years ago
Thu, Oct 14, 21, 00:00, 3 Years ago
Thu, Jul 15, 21, 00:00, 3 Years ago
Sat, Oct 24, 20, 00:00, 4 Years ago
Thu, Sep 3, 20, 00:00, 4 Years ago
;