How does JS judge whether the text value of < td > is or not?

<td class="bz">  </bz>

js 

$(".bz").each(function(i,n){
    var obj = $(n);
    var val = obj.text();
    alert(val);
    if(val == "" || val == null || val == undefined){
        alert(val);
        wglx += "null,";
    }else{
        wglx += obj.text() + ",";
    }
        
});
< H2 > the problem now is when there is no content in td < / H2 >

if (val = =""| | val = = null | | val = = undefined)
this sentence has no effect
and if there is a value, alert will not be executed at all
cannot be judged

.
Oct.07,2021

Brother problem has been found. Look at the screenshot! See if it's your problem.


trim after taking out the value


upstairs is right. I'll test it for you. It's OK to have no spaces at first, but if you add spaces, there will be problems, so you can't pop up. Add trim:
can code: http://jsrun.net/N8hKp/edit

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5f7a8-444ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5f7a8-444ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?