What does `Number.isNaN(NaN)` return compared to the global `isNaN(NaN)`?

JavaScript Developer Easy

JavaScript Developer — Easy

What does `Number.isNaN(NaN)` return compared to the global `isNaN(NaN)`?

Key points

  • Number.isNaN does not coerce the value before checking
  • global isNaN behaves differently with non-numeric strings
  • Both return true for NaN values
  • Understanding these differences is crucial for accurate NaN checks in JavaScript

Ready to go further?

Related questions