Created
July 12, 2011 14:29
-
-
Save honza/1078088 to your computer and use it in GitHub Desktop.
What looks best?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* How do you like your Javascript variables? | |
* Is there a PEP8 for Javascript? | |
*/ | |
// Option 1 | |
var viewPage = function() {}; | |
// Option 2 | |
var view_page = function() {}; | |
// Option 3 | |
var ViewPage = function() {}; |
Option 3 is for classes. Option 1 is for everything else. I think this is the norm.
What you're describing seems to be Python. :)
Yep, in Python I'd use 2 and 3
In Java, C# or C++ I'd use 1 and 3
In C I'd just use 2
In Javascript, I'd probably still just use 2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Situation wise, I'd say first one for object instance, second one for function/variable names, and third one for class names.
However I like the second one best for plain old variables.