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?
|