function lt(a,b) { return a<b; } function gt(a,b) { return a>b; } var bool = true; alert( ( bool ? gt : lt )( 5, 7 ) );