I render the html in php ,and use jQuery .they have such html code :
<div>
<tr class="selectClass"></tr>
<tr class="selectClass"></tr>
</div>
In some condition , it will remove this <tr class="selectClass"></tr>
,
and become :
<div>
</div>
I have to judge this two situations ,I try different way , but the result is strange .
var selectTr = $('.selectClass') ;
if( selectTr ){
console.log("i am undefined") ;
}
it do not print anything .
var selectTr = $('.selectClass') ;
if( typeof (selectTr) == "undefined" ){
console.log("i am undefined") ;
}
it do not print "i am undefined " .
so i try it
console.log(typeof (selectTr))
, it is object .
My problem is that :
how to judge a empty object and why it is object instead of null or undefined?