Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6211

Unexpected behavior when comparing null to null

$
0
0

I'm sure this is something completely, but I just can't seem to wrap my head around it. I'm trying to check if a variable is null in my react native app, but it's not behaving as I expect. This is a console.log showcasing my issue:

    console.log(        this.props.until,        this.props.until != null,        this.props.until !== null,        !this.props.until,        !!this.props.until);

And this is the output:

[null, true, true, false, true]

How can the variable be null, but not be compared to null. I thought I had a basic understanding of Typescript, but apparently not.

Thanks for your help, appreciate it!


Viewing all articles
Browse latest Browse all 6211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>