-
Notifications
You must be signed in to change notification settings - Fork 649
Javascript style guide
javisantana edited this page Jun 4, 2012
·
9 revisions
this is the style guide for javascript in cartodb
- GLOBALS_ARE_UPPERCASE_AND_UNDERSCORED
- local variables are as short as you can and camelCase
- use self to scope this
- function and method names are camelCase
- private methods start with underscore
- class names are CamelCase (capitalized)
every class or method should be commented. Ok. every class or method which is not clear should be commented
/**
* this function executes whatevet
* @param a blablablala
* returns 0 if blwbla..
*/
function myFunction(a) {
}
- variable declaration:
var a,
b,
c;
- we use semicolons (use jslint or similar to check)