Let's say you have the following function:
var variable;
function(variable);
function function(variable) {
    alert ("variable equals " + variable);
    if (variable != 'undefined') {
        ~~~code1~~~
    } else {
        ~~~code2~~~
    }
}
The alert outputs:
variable equals undefined
However, ~~~code2~~~ is never executed. I'm guessing that my syntax is incorrect. If I haven't defined the variable, how do I get the function function to execute ~~~code2~~~?
Extra Information
When the variable variable is hardcoded, as in the following code:
var variable;
function(variable)
function function(variable) {
    variable = 2;
    alert ("variable equals " + variable);
    if (exponent == 2) {
        ~~~code1~~~
    } else {
        ~~~code2~~~
    }
}
~~~code1~~~ is executed.
 
    