I’d like to use the style JQuery uses:
I looked here:
but could not find it. Is it the same as PHP Zend style – All caps w/ underscores to seperate names?
I dowloaded the latest verion of JQuery and ran a search for constants but nothing came up.
Here is how I do my constants.
var Constant =
{
/**
* Code Configuration
*/
validate: 1,
/**
* Paths Configuration
*/
root: '',
pictures_path: '../pictures/',
images_path: '../images/',
txt_path: '../text/',
favicon: '../images/' + 'logo_small.ico',
gateway_path: 'class.ControlEntry.php',
/**
* General
*/
enter_key: 13,
second : 1000,
minute: 60,
hour: 3600,
day: 43200,
start: 'hide_1',
aml:
{
"pass": 0,
"fail": 1,
"undefinedU": 2
}
};
If you look through the jQuery API (and even the name
jQueryitself), it is pretty noticeable that jQuery usescamelCasemost of the time.Here are a few examples.
All methds that are a result of seleting an element are camel-case:
addClass, removeClass, ajaxComplete, ajaxSend, after, add, append, appendTo
Most methods/properties that are members of jQuery are also camel-case, with a few exceptions.
ajax, ajaxSetup, boxModel, browser, contains, cssHooks, data
The exceptions are:
Deferred because it returns a new deferred object, and Callbacks because it returns a new Callbacks object.