What happens if the variable is an empty string or 0?  Why not check for "undefined" here explicitly?