View Single Post
  #1 (permalink)  
Old 04-26-2008, 08:55 PM
mamba_namba mamba_namba is offline
Newbie
 
Join Date: Apr 2008
Posts: 4
Rep Power: 0
mamba_namba is on a distinguished road
Default new to javascript, help with reducing redundancy

say i have these two functions:

Code:
function one(object)
object.style.right=1px;

function two(object) {
object.style.top=1px;
}

is there a way i could reduce redundancy by combining these two functions into one by adding an extra parameter? im thinking of something like this:

Code:
function three(object, direction) {
object.style.direction=1px;
}
how would i do something like this?

Last edited by Jordan; 04-28-2008 at 11:58 AM.
Reply With Quote

Sponsored Links