It checks to see if v NaN:
if( v !== v ){
//'v' is NaN here
}
From standard :
A reliable way for ECMAScript to check if an X NaN value is an expression of the form X! == X. The result will be true if and only if X is NaN.
Why not just use the built-in isNaN()?
The answer is simple: " not reliable enough. ". Here are cases when there will be a failure: isNaN()isNaN()
isNaN("NaN")
isNaN(undefined)
source
share