0% found this document useful (0 votes)
17 views

Javascript Naming Guidelines:: Every Constant Variable Name Should Be in Upper Case

This document provides JavaScript naming and formatting guidelines. It recommends using camelCase for function and variable names, declaring all variables at the top of functions, and prefixing variable names with data types. Constants should be in uppercase. Code should be formatted with spacing between elements for readability. Braces should be on their own lines.

Uploaded by

dimpledevani
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Javascript Naming Guidelines:: Every Constant Variable Name Should Be in Upper Case

This document provides JavaScript naming and formatting guidelines. It recommends using camelCase for function and variable names, declaring all variables at the top of functions, and prefixing variable names with data types. Constants should be in uppercase. Code should be formatted with spacing between elements for readability. Braces should be on their own lines.

Uploaded by

dimpledevani
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Javascript Programming Standards and Guidelines. Ver 1.

JavaScript Naming Guidelines: Function names should begin with a lowercase letter, and the first letter of each subsequent new word should be uppercase with all other letters lowercase. (camelCase) Example: function myFirstFunction ... !ll "ariables should be declared in first lines of code. #n addition, all "ariables must be declared in functions to $eep them local. %ariable names should begin with a lowercase letter, and the first letter of each subsequent word should be uppercase with all other letters lowercase. %ariable names should indicate their data type with a consistent prefix (bln & boolean' flt & floating point' int & integer' ob( & ob(ect' str & string).

Example : bln#s%alid , int)eight , ob(*able , strFoo .


E"ery constant "ariable name should be in upper case.

Example: const C+,-!./0.!,E 1 23healsoft4'

Spacing
Consider the following two lines:

for(x=1;x<10;x++){y+=x;alert(x);}
+r:

for ( x=1; x<10; x++ ) { y += x; alert( x ); }


!s far as readability, the second rendition is more pleasurable to read. *he terseness of the first line can be confusing to the eyes. !dditionally, it is suggested that one blan$ line should be placed before and after a function5class declaration to increase readability. *oo much of space is not recommended as it affects the performance in the client side too, howe"er marginally.

Braces
*he following two lines pro"ide a demonstration:

for ( x=1; x<10; x++ ) {


+r:

for ( x=1; x<10; x++ ) {


*he braces should be on its own line for better readability . 6o First one is recommended.

Rheal Software Pvt. Ltd.

You might also like