About the problem of val value evaluation in function

Today I encountered the value of row.name obtained in datetables

Pass in the click event, and judge whether the value is empty. Finally, it is found that the judgment condition is wrong.

Original conditions

if(name == null || name == undefined || name == "" || name == "undefined"){
    $('.bb').css('display','block');
} else {
     alert ( "no" );
     if ( confirm ( "Does the file already exist?" )){
         $ ( '.bb' ). css ( 'display' , 'block' );
    }else {

    }
}
Change it to:
if(name == null || name == undefined || name == "" || name == "undefined"|| name=="null"){
    $('.bb').css('display','block');
} else {
     alert ( "no" );
     if ( confirm ( "Does the file already exist?" )){
         $ ( '.bb' ). css ( 'display' , 'block' );
    }else {

    }
}
It's just that there is one less "null". In fact, the value obtained in tatetables is "null" instead of null. According to the inertial thinking, we will write null directly,
and the value obtained when I alert on the page is also null, so this problem bothered me for 3.4 hours Later, when the page was dubugged, it was found that "null"
was really nothing to say.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325772123&siteId=291194637
Recommended