Function organization strategies

D

Derek Basch

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
 
M

McKirahan

Derek Basch said:
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

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".
*/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top