is there a standard in namespace capitalization for Javascript

I'm adopting a large mish-mash of Javascript / jQuery code. I'd like to move it to Backbone.js but as an intermediary, I'm trying to namespace it so that it is sligthtly more modular.

I am wondering if there is a standard for namespaces for Javascript. I was going to do something like this:

var arc={

    //alert('name' +;


Should arc be capitalized? I tend to see capitalized but since rest of site is in Ruby, lowercase might be more consistent.




In javascript, camelCase is used for regular identifiers. CAPSLOCKS is used for "constants". ProperCase is used for object constructors (indicating they should always be invoked using new).


There is no absolute standard for captilization in Javascript. The over whelming majority of javascript though prefers camel casing. In short camel casing has the first letter of an identifier in lower case and then capitalizes the start of every subsequent word in a name. Here arc is a single word and hence all lower is appropriate.


This come down to personal preference. Our code best practice define that only function constructor have to be capitalised. For me the instance of an object is then lowercase.

Do google search for "javascript code guidleine" and see what other are doing


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.