How to check if floating point is NaN in JavaScript

3 Answers

0 votes
const value = NaN;

console.log(Number.isNaN(value)); 
 
 

/*
run:

true

*/

 



answered Aug 3, 2025 by avibootz
0 votes
const value = NaN;

console.log(isNaN(value)); 
 
 

/*
run:

true

*/

 



answered Aug 3, 2025 by avibootz
0 votes
const value = NaN;

console.log(value !== value); 
 
 

/*
run:

true

*/

 



answered Aug 3, 2025 by avibootz
...