Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Six JavaScript features we do not need any longer

Status
Not open for further replies.

gerases

Programmer
Joined
Apr 27, 2006
Messages
29
Location
US
Found this article on the net:
Can someone explain to me what the author is talking about in item 6? More precisely, what is the alternative to passing a lot of paramaters to a function?

For example, I have a user list. When one presses "Edit" next to a user, a form is filled out. The form is filled out by a function that takes a bunch of parameters. All the parameters initially come from the database and are attached to each of the edit buttons. How can this be improved? The only thing I can think about is a Javascript array that is populated by a server side language. Then the edit function could take only 1 parameter -- an offset in the array.

I'm really curious as to what that article is talking about because that's precisely my situation in many cases.
 
What the author was getting at was that sometimes you don't always need to pass any parmmeters to a function, and a lot of the time, people pass things that they can greatly simplify.

I don't think he is saying you should never pass parameters... more that you should look at how your code is structured, and see if you can do away with them or simplify them.

For you app, it might be the case that you still need them. Without seeing your code, it would be fruitless to speculate, however.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top