jeudi 12 décembre 2019

A conditional statement checking for null not working

I have a variable named header that is null and typeof header shows string. But, it doesn't meet any of the following condition:

        const header = request.request ? request.request.headers.authorization : request.connection.context.Authorization
        if(header == '' || header == null || header == undefined || header == false || header == 0 || header == NaN || !!header) {
            console.log("Condition met")    
        }   

It doesn't seem like there any more way to qualify null. What's happening?

Aucun commentaire:

Enregistrer un commentaire