Use Number.isNaN() to check if a value is NaN:
let result = "hello" * 2
console.log(Number.isNaN(result)) // true
There's also a global isNaN() function, but it's unreliable. It converts values first, giving wrong results:
isNaN("hello") // true (wrong! it's a string)
Number.isNaN("hello") // false (correct)
Always use Number.isNaN() for accurate checks.