0

I can't seem to understand why when I put in the console isNaN == true results to false while !isNaN == false returns to true.

When

NaN == true
false
NaN == false
false

Sorry I'm kinda new and somewhat confused.

icedev
  • 215
  • 1
  • 17

2 Answers2

1

isNaN is a function which determines if the value is NaN. So isNaN will check if the input is a number or not .

For example isNaN(5) == true will return false , because 5 is a number, Simillarly for empty string isNaN('') == true will also return false it is not a number. But for isNaN('Hello') == true will return true, since 'Hello' is not a number

Now when using negation(!) it will work oppositely

brk
  • 48,835
  • 10
  • 56
  • 78
0

The isNaN() function determines whether a value is NaN or not.

its return true if the given value is NaN; otherwise, false.

see below link for more info

Darshak
  • 859
  • 7
  • 18