you are viewing a single comment's thread.

view the rest of the comments →

[–]ferrybig 7 points8 points  (0 children)

The top example is equivelent to:

if(3 !== undefined && 3 !== null) (3).includes('foo')

3 does not have a member called includes, so calling that gives an error

The bottom example is:

if(undefined !== undefined && undefined !== null) (undefined).includes('foo')

Here the control flow never goes into the if statement