Function organization strategies

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Derek Basch

    Function organization strategies

    What is the best method for organizing dozens of functions in a
    Javascript file? Alphabetically? According to function purpose? Anyone
    have a tried and true method?

    Thanks,
    Derek Basch

  • McKirahan

    #2
    Re: Function organization strategies

    "Derek Basch" <dbasch@yahoo.c om> wrote in message
    news:1109364812 .243312.229510@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    > What is the best method for organizing dozens of functions in a
    > Javascript file? Alphabetically? According to function purpose? Anyone
    > have a tried and true method?
    >
    > Thanks,
    > Derek Basch
    >[/color]

    You can do both. For example:

    function edit_page1()
    function edit_page2()
    function form_build()
    function form_reset()
    function page_search()

    I often identify each function with a short description at the top in a
    comment block.

    /*
    * function edit_page1() -- performs data validation for "page1.htm" .
    * function edit_page2() -- performs data validation for "page2.htm" .
    */


    Comment

    Working...