javascript typeof item === "undefined" never returns true
<p>In the following code sample, typeof item === "undefined" never returns true.  i am trying to get an attribute from XML, if the attribute is not there in the XML it returns "undefined", but i am not able to capture whether it has returned undefined or not, firebug shows "typeof item" as an "object"</p>

<pre><code>var item;
var itemIDs = {};
if (items.status == 200)
{   
    var rows = items.responseXML.getElementsByTagName('z:row');
    for(i=0;i&lt;rows.length;i++)
    { 
        //rows[i].attr(attribute);
        item = rows[i].getAttribute(attribute);
        if(typeof item === "undefined")
        {
            continue;

        }
        else
        {
            item = item.match(/[^\d+;#][\w\W]+/);
            itemIDs[item] = 1 ;
        }

    }
}
else
{
     alert('There was an error: ' + items.statusText);
}

return itemIDs;
</code></pre>

<p><strong>Edit:</strong> I changed the condition to if(item == undefined), The code now works as expected now</p>

<p><strong>Edit2:</strong> Double checked it, item variable was never null , it was "undefined"</p>
