Forum Moderators: phranque

Message Too Old, No Replies

javascript conventions

looking for javascript coding conventions.

         

jmirick

8:28 pm on Mar 5, 2001 (gmt 0)



Hey all..
Im currently working on a web project with about 3 other developers and we are looking for some sort of documentation for javascript coding conventions (function names should look like this... var names should look like that... etc). So our code is readable to all the memebers of the team.

Im sure there is something out there that we could use as a baseline (I just cant seem to find it).

thanks
john

tedster

9:22 pm on Mar 5, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's a great question. Naming conventions would certainly be up to the particular team/job. I don't know of an exmple online.

I have found one resource [kuse.ite.mh.se] that has tips and cautions that can be of use in developing your own conventions. Theyre mixed in with a basic js tutorial. Here's a sample of the kind of guidelines they offer:

CAUTION:
It is bad practice to change the implicit data type of a variable. If a variable is initialized to have a certain type (such as string) it should always have that type.

Xoc

8:06 pm on Mar 6, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



While I don't have JavaScript coding standards, I am the author of one of the most widely used Visual Basic coding standards (written up in probably 20 books). You could probably convert them to JavaScript pretty easily. See [xoc.net...] for both naming and coding conventions.