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

say i have these two functions:

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:

function three(object, direction) {
object.style.direction=1px;
}

how would i do something like this?
Reply With Quote

Sponsored Links