If it is undefined, it will not be equal to a string that contains the characters "undefined", as the string is not undefined.
You can check the type of the variable:
if (typeof(something) != "undefined") ...
Sometimes you don't even have to check the type. If the value of the variable can't evaluate to false when it's set (for example if it's a function), then you can just evalue the variable. Example:
if (something) {
something(param);
}